Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/build_and_test_rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,48 @@ jobs:
workflow_id: '${{ secrets.INTEGRATION_TEST_WORKFLOW }}.yaml',
ref: 'main'
})
revoke:
runs-on: ubuntu-latest
needs: build
permissions:
actions: write
steps:
- uses: actions/checkout@v4
- name: Mark older approvals as unnecessary
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Find previous workflow runs for the same workflow
runs=$(gh run list --workflow=153308063 --json databaseId,status --jq '.[] | select(.status == "waiting") | .databaseId')
for run_id in $runs; do
echo "Marking workflow run $run_id as outdated"
gh run cancel $run_id
done
deploy:
name: Deploy to production
runs-on: ubuntu-latest
needs: [build, revoke]
environment: prod
permissions:
contents: read
id-token: write

steps:
- name: Call workflow
uses: actions/github-script@v7
with:
github-token: ${{ secrets.DEPLOY_PAT }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'statisticsnorway',
repo: '${{ secrets.DEPLOY_REPO }}',
workflow_id: '${{ secrets.DEPLOY_WORKFLOW }}.yaml',
ref: 'master',
inputs: {
environment: "PROD",
service: "metadata-service"
}
})
45 changes: 45 additions & 0 deletions .github/workflows/test-and-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,48 @@ jobs:
workflow_id: '${{ secrets.INTEGRATION_TEST_WORKFLOW }}.yaml',
ref: 'main'
})
revoke:
runs-on: ubuntu-latest
needs: build
permissions:
actions: write
steps:
- uses: actions/checkout@v4
- name: Mark older approvals as unnecessary
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Find previous workflow runs for the same workflow
runs=$(gh run list --workflow=87753572 --json databaseId,status --jq '.[] | select(.status == "waiting") | .databaseId')
for run_id in $runs; do
echo "Marking workflow run $run_id as outdated"
gh run cancel $run_id
done
deploy:
name: Deploy to production
runs-on: ubuntu-latest
needs: [build, revoke]
environment: prod
permissions:
contents: read
id-token: write

steps:
- name: Call workflow
uses: actions/github-script@v7
with:
github-token: ${{ secrets.DEPLOY_PAT }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'statisticsnorway',
repo: '${{ secrets.DEPLOY_REPO }}',
workflow_id: '${{ secrets.DEPLOY_WORKFLOW }}.yaml',
ref: 'master',
inputs: {
environment: "PROD",
service: "metadata-service"
}
})