Ferry withdrawal service #1301
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: Pull Request | |
on: | |
pull_request: | |
types: [labeled, opened, synchronize, unlabeled, closed] | |
permissions: | |
contents: write | |
id-token: write | |
deployments: write | |
checks: write | |
# The following concurrency group cancels in-progress jobs or runs on pull_request events only | |
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
init: | |
name: Set global version | |
if: github.event.action != 'unlabeled' && github.event.action != 'closed' | |
runs-on: ubuntu-latest | |
outputs: | |
GLOBAL_VERSION: ${{ steps.set_vars.outputs.GLOBAL_VERSION }} | |
steps: | |
- name: Set global version | |
id: set_vars | |
run: | | |
echo "GLOBAL_VERSION=${{ github.sha }}" >> $GITHUB_OUTPUT | |
echo "IMAGE TAG=${{ github.sha }}" >> $GITHUB_STEP_SUMMARY | |
build-and-test: | |
needs: [init] | |
name: Build | |
uses: ./.github/workflows/reusable-build-and-test.yml | |
secrets: inherit | |
with: | |
version: ${{ needs.init.outputs.GLOBAL_VERSION }} | |
deploy-fungible: | |
name: Deploy fungible environment | |
if: | | |
(github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == ':rocket: deploy_fungible') || | |
(github.event_name == 'pull_request' && github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, ':rocket: deploy_fungible')) | |
needs: [init, build-and-test] | |
uses: ./.github/workflows/reusable-deploy.yml | |
secrets: inherit | |
with: | |
env: fungible | |
version: ${{ needs.init.outputs.GLOBAL_VERSION }} | |
run-e2e-test: | |
name: Run e2e tests | |
needs: [init, build-and-test] | |
uses: ./.github/workflows/reusable-e2e-tests.yml | |
secrets: inherit | |
permissions: | |
contents: read | |
actions: read | |
checks: write | |
with: | |
globalVersion: ${{ needs.init.outputs.GLOBAL_VERSION }} | |
clean-up-fungible: | |
name: Delete fungible environment | |
if: | | |
(github.event_name == 'pull_request' && github.event.action == 'unlabeled' && github.event.label.name == ':rocket: deploy_fungible') || | |
(github.event_name == 'pull_request' && github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, ':rocket: deploy_fungible')) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: google-github-actions/auth@v2 | |
with: | |
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | |
- name: Set up GKE credentials | |
uses: google-github-actions/get-gke-credentials@v0.8.2 | |
with: | |
cluster_name: mangata-dev-alpha | |
location: europe-west1 | |
- name: Delete Kubernetes namespace with resources for fungible environment | |
run: kubectl delete namespace rollup-pr-${{ github.event.number }} | |
- name: Delete GitHub Deployment environment | |
if: always() | |
uses: bobheadxi/deployments@v1.4.0 | |
with: | |
step: deactivate-env | |
token: ${{ secrets.GITHUB_TOKEN }} | |
env: pr-${{ github.event.number }} | |