Release workflow #49
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: Release workflow | |
on: | |
workflow_dispatch: | |
inputs: | |
commit: | |
description: "Leave blank to use current HEAD, or provide an override commit SHA" | |
type: string | |
required: false | |
jobs: | |
ref: | |
name: Load Commit Ref | |
runs-on: ubuntu-latest | |
steps: | |
- id: ref | |
uses: passportxyz/gh-workflows/.github/actions/load_commit_ref@v1 | |
with: | |
commit: ${{ inputs.commit }} | |
outputs: | |
version_tag: ${{ steps.ref.outputs.version_tag }} | |
docker_tag: ${{ steps.ref.outputs.docker_tag }} | |
refspec: ${{ steps.ref.outputs.refspec }} | |
test: | |
name: Test | |
needs: [ref] | |
uses: ./.github/workflows/test_generic.yml | |
with: | |
refspec: ${{ needs.ref.outputs.refspec }} | |
environment: review | |
secrets: inherit | |
create-draft-release: | |
name: Create Draft Release | |
runs-on: ubuntu-latest | |
needs: [ref, test] | |
permissions: write-all | |
steps: | |
- name: Release | |
# https://github.com/ncipollo/release-action | |
uses: ncipollo/release-action@v1 | |
with: | |
generateReleaseNotes: true | |
allowUpdates: true | |
token: ${{ secrets.github_token }} | |
tag: ${{ needs.ref.outputs.version_tag }} | |
commit: ${{ needs.ref.outputs.refspec }} | |
draft: true | |
deploy-staging: | |
name: Deploy to Staging | |
needs: [create-draft-release, ref] | |
uses: ./.github/workflows/build_and_deploy_generic.yml | |
with: | |
refspec: ${{ needs.ref.outputs.refspec }} | |
docker_tag: ${{ needs.ref.outputs.docker_tag }} | |
environment: staging | |
secrets: inherit | |
deploy-interface-to-staging: | |
name: Push code to staging branch | |
needs: [ref, deploy-staging] | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.ref.outputs.refspec }} | |
fetch-depth: 0 | |
- id: push-to-branch | |
uses: passportxyz/gh-workflows/.github/actions/push_to_branch@v1 | |
with: | |
commit: ${{ needs.ref.outputs.refspec }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
branch: staging-interface | |
deploy-production: | |
name: Deploy to Production | |
needs: [ref, deploy-staging, deploy-interface-to-staging] | |
uses: ./.github/workflows/build_and_deploy_generic.yml | |
with: | |
refspec: ${{ needs.ref.outputs.refspec }} | |
docker_tag: ${{ needs.ref.outputs.docker_tag }} | |
environment: production | |
secrets: inherit | |
deploy-interface-to-production: | |
name: Push code to branch | |
needs: [ref, deploy-production] | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.ref.outputs.refspec }} | |
fetch-depth: 0 | |
- id: push-to-branch | |
uses: passportxyz/gh-workflows/.github/actions/push_to_branch@v1 | |
with: | |
commit: ${{ needs.ref.outputs.refspec }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
branch: production-interface | |
release: | |
name: Release | |
needs: [ref, create-draft-release, deploy-production, deploy-interface-to-production] | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- name: Release | |
# https://github.com/ncipollo/release-action | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
token: ${{ secrets.github_token }} | |
tag: ${{ needs.ref.outputs.version_tag }} | |
commit: ${{ needs.ref.outputs.refspec }} | |
draft: false |