Test, build, deploy #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test, build, deploy | |
env: | |
ENTRY: 24 | |
GH_PAGES_DOMAIN: blockchainweek.github.io | |
DENO_DIR: /home/runner/.deno-cache | |
on: | |
workflow_dispatch: | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ env.TAG }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Cache Deno dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.DENO_DIR }} | |
key: ${{ hashFiles('utils') }} | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- uses: szenius/[email protected] | |
with: | |
timezoneLinux: "Europe/Berlin" | |
- run: make install | |
- run: "deno run --allow-run utils/tag.js >> $GITHUB_ENV" | |
- run: "echo \"Tag: ${{ env.TAG }}\"" | |
- run: "make tag=${{ env.TAG }}" | |
- run: find dist | |
- uses: montudor/action-zip@v1 | |
- run: "zip -qq -r release.zip dist" | |
- run: "touch dist/CNAME && echo \"${{ env.GH_PAGES_DOMAIN }}\" >> dist/CNAME" | |
- uses: actions/configure-pages@v3 | |
- uses: actions/upload-pages-artifact@v1 | |
with: | |
path: 'dist' | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: release | |
path: release.zip | |
release: | |
needs: [build] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- run: "echo \"TAG=${{ needs.build.outputs.tag }}\" >> $GITHUB_ENV" | |
- run: "echo \"Tag: ${{ env.TAG }}\"" | |
- uses: actions/download-artifact@v3 | |
with: | |
name: release | |
- uses: montudor/action-zip@v1 | |
- run: unzip -qq release.zip | |
- run: "zip -qq -r ../bbw-${{ env.ENTRY }}-${{ env.TAG }}.zip ${{ env.ENTRY }}" | |
working-directory: ./dist | |
- uses: rickstaa/action-create-tag@v1 | |
with: | |
tag: "${{ env.TAG }}" | |
message: "Latest release" | |
github_token: '${{ secrets.GITHUB_TOKEN }}' | |
- uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: "${{ env.TAG }}" | |
name: "${{ env.TAG }}" | |
body: "This is a automated release." | |
draft: false | |
prerelease: false | |
files: | | |
bbw-${{ env.ENTRY }}-${{ env.TAG }}.zip | |
deploy: | |
needs: [build] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
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@v1 | |
trigger_explore_rebuild: | |
needs: [deploy] | |
runs-on: ubuntu-latest | |
environment: | |
name: remote-triggers | |
steps: | |
- run: | | |
curl \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{secrets.PAT_TOKEN}}"\ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/blockchainweek/explore/actions/workflows/gh-pages.yml/dispatches \ | |
-d '{"ref":"main"}' |