From f68b6ed22ba9a935e0290218406c0b7b5049a8e7 Mon Sep 17 00:00:00 2001 From: Nir Galon Date: Mon, 24 Jun 2024 01:07:38 +0300 Subject: [PATCH] fix: deployment workflow --- .github/workflows/continuous-deployment.yml | 74 --------------------- .github/workflows/deploy.yml | 57 ++++++++++++++++ components/AppHeader.vue | 33 +++++++-- pages/index.vue | 21 +++++- 4 files changed, 103 insertions(+), 82 deletions(-) delete mode 100644 .github/workflows/continuous-deployment.yml create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/continuous-deployment.yml b/.github/workflows/continuous-deployment.yml deleted file mode 100644 index 41476a9..0000000 --- a/.github/workflows/continuous-deployment.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Continuous Deployment - -on: - push: - branches: - - main - schedule: - - cron: "0 7 1 * *" # Every first day on every month at 7:00 AM UTC (10:00 AM Israel time). - -# Allow this job to clone the repo and create a page deployment -permissions: - contents: write - pages: write - id-token: write - pull-requests: write - repository-projects: write - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout your repository using git - uses: actions/checkout@v3 - - - name: Install and build website - uses: withastro/action@v0 - - publish-release: - needs: build - runs-on: ubuntu-latest - name: Publish a release to GitHub - steps: - - uses: actions/checkout@v3 - - - name: Create Release 🚀 - uses: ridedott/release-me-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - release-branches: '["main"]' - node-module: true - - deploy: - needs: build - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v1 - - # build-index: - # needs: deploy - # runs-on: ubuntu-latest - # name: Build search index and push it to Algolia - # steps: - # - name: Checkout your repository using git - # uses: actions/checkout@v3 - - # - name: Install dependencies - # run: npm install - - # - name: Create index file - # run: node index-posts.js - - # - name: Update index.json To Algolia - # run: npx atomic-algolia - # env: - # ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} - # ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }} - # ALGOLIA_INDEX_NAME: index.json - # ALGOLIA_INDEX_FILE: ./dist/index.json diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..403c5ed --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,57 @@ +name: Deploy to GitHub pages on merge + +on: + push: + branches: + - main + schedule: + - cron: "0 7 1 * *" # Every first day on every month at 7:00 AM UTC (10:00 AM Israel time). + +jobs: + build_and_publish: + runs-on: ubuntu-latest + name: Publish a release to GitHub + outputs: + version: ${{ steps.release_version.outputs.version }} + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "lts/*" + + - run: npm install + + - run: npx nuxt generate + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./.output/public + + - name: Create Release 🚀 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npx semantic-release + + # Deployment job + deploy: + # Add a dependency to the build job + needs: build_and_publish + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + # Deploy to the github_pages environment + environment: + name: github_pages + url: ${{ steps.deployment.outputs.page_url }} + # Specify runner + deployment step + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/components/AppHeader.vue b/components/AppHeader.vue index a51f7a2..12e02e5 100644 --- a/components/AppHeader.vue +++ b/components/AppHeader.vue @@ -1,4 +1,5 @@