diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml new file mode 100644 index 0000000..ef073a6 --- /dev/null +++ b/.github/workflows/deploy-gh-pages.yml @@ -0,0 +1,71 @@ +name: Deploy to GitHub pages + +on: + push: + branches: [ "master" ] + workflow_dispatch: + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "gh-pages" + cancel-in-progress: false + +permissions: {} + +jobs: + build: + name: Build site + runs-on: ubuntu-latest + if: github.repository_owner == 'silverstripe' + permissions: + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Read .nvmrc + id: read-nvm + shell: bash + run: echo "version=$(cat .nvmrc)" >> "$GITHUB_OUTPUT" + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: ${{ steps.read-nvm.outputs.version }} + + - name: Setup GH pages + id: pages + uses: actions/configure-pages@v5 + + - name: Build static files + shell: bash + run: | + cat << EOF > .env + VUE_APP_GRAPHQL_ENDPOINT=https://api.github.com/graphql + VUE_APP_GRAPHQL_TOKEN=${{ secrets.GRAPHQL_TOKEN_FOR_GH_PAGES }} + EOF + npm install + npx update-browserslist-db@latest --yes + npm run now-build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: "dist/" + + deploy: + name: Deploy site + needs: build + runs-on: ubuntu-latest + if: github.repository_owner == 'silverstripe' + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{steps.deployment.outputs.page_url}} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index be02246..3903e91 100644 --- a/.gitignore +++ b/.gitignore @@ -19,5 +19,3 @@ yarn-error.log* *.njsproj *.sln .env - -.vercel diff --git a/.nowignore b/.nowignore deleted file mode 100644 index 3c3629e..0000000 --- a/.nowignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/README.md b/README.md index f52b4de..5720b08 100644 --- a/README.md +++ b/README.md @@ -9,24 +9,18 @@ as well as other repositories that are important for maintenance. It uses [vue-cli](https://github.com/vuejs/vue-cli/blob/dev/docs/cli.md) to simplify local development and production builds for VueJS. -You can use it on https://github-issue-search-client-silverstripe.vercel.app. +You can use it on . ![Preview](_img/preview.png) -This project is powered by [Vercel](https://vercel.com/?utm_source=silverstripe&utm_campaign=oss). - -![Vercel logo](_img/vercel-logotype-dark.png) - ## Install -Use Node v8 or higher. +Use Node (see .nvmrc for correct version to use). ```bash npm install ``` -For deployment, you will need to [install Vercel](https://vercel.com/download/?utm_source=silverstripe&utm_campaign=oss) and log in. - ## Configure Create an `.env` with: @@ -44,7 +38,8 @@ The only reason to include it here is avoiding to hit Github's rate limits witho In order to get an updated list of the repositories we care about, you can run the following command. This will be written to the `repos.json` file in the `src` folder, which can be updated (in VCS) periodically if required. -This gets run during a deployment and auto-update in the Vercel environment. + +This gets run during a deployment. ```bash npm run get-repos @@ -66,38 +61,16 @@ npm run build ### Continuous deployment -The project is published to [Vercel](https://vercel.com/?utm_source=silverstripe&utm_campaign=oss) automatically when changes are merged into the master branch. -This is done via an automatic GitHub integration. +The project is published to [GitHub Pages](https://docs.github.com/en/pages) automatically when changes are merged into the master branch. +This is done via a GitHub Actions workflow. ### Manual deployment -You can also deploy projects manually. To do this you will need to have the [Vercel CLI](https://vercel.com/cli/?utm_source=silverstripe&utm_campaign=oss) installed, be -logged in, part of the ["silverstripe" Vercel team](https://vercel.com/teams/silverstripe/settings/members/?utm_source=silverstripe&utm_campaign=oss), -and have the team configured in your profile. For access to the team, contact Ingo or Garion. - -```bash -# Login if necessary -vercel login - -# Switch to SilverStripe Ltd team -vercel teams switch silverstripe - -# Ship it! -vercel -``` - -It will give you an updated URL to run in your browser. This will also run automatically as a Git hook. +You can also deploy projects manually. To do this go to the [Actions tab in GitHub](https://github.com/silverstripe/github-issue-search-client/actions/workflows/deploy-gh-pages.yml), and click "Run workflow". ### API keys -To store the GraphQL API token in an environment variable for Now, you need to use the CLI to save is as a -[secret](https://zeit.co/docs/v2/deployments/environment-variables-and-secrets/?utm_source=silverstripe&utm_campaign=oss#securing-environment-variables-using-secrets): - -```bash -vercel secret add graphql-api-key YOURAPITOKENHERE -``` - -The secret variable name `@graphql-api-key` is referenced from `now.json` to map to an environment variable. +There is a historic token stored in the repository as a secret. If you ever need to cycle the token, just update the value of the secret in this repository and redeploy. ## Usage diff --git a/src/App.vue b/src/App.vue index a3c1eb7..8648479 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,16 +6,6 @@ - diff --git a/vue.config.js b/vue.config.js index 12e77a1..38fcc14 100644 --- a/vue.config.js +++ b/vue.config.js @@ -8,5 +8,6 @@ module.exports = { apollo: { lintGQL: false } - } + }, + publicPath: "./" }