Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.

Commit 05975a9

Browse files
authored
Merge pull request #61 from statisticsnorway/deploy-prod
Deploy prod
2 parents 47f1460 + 35fa460 commit 05975a9

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.github/workflows/build_and_test_rust.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,48 @@ jobs:
9595
workflow_id: '${{ secrets.INTEGRATION_TEST_WORKFLOW }}.yaml',
9696
ref: 'main'
9797
})
98+
99+
revoke:
100+
runs-on: ubuntu-latest
101+
needs: build
102+
permissions:
103+
actions: write
104+
steps:
105+
- uses: actions/checkout@v4
106+
- name: Mark older approvals as unnecessary
107+
env:
108+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109+
run: |
110+
# Find previous workflow runs for the same workflow
111+
runs=$(gh run list --workflow=153308063 --json databaseId,status --jq '.[] | select(.status == "waiting") | .databaseId')
112+
113+
for run_id in $runs; do
114+
echo "Marking workflow run $run_id as outdated"
115+
gh run cancel $run_id
116+
done
117+
118+
deploy:
119+
name: Deploy to production
120+
runs-on: ubuntu-latest
121+
needs: [build, revoke]
122+
environment: prod
123+
permissions:
124+
contents: read
125+
id-token: write
126+
127+
steps:
128+
- name: Call workflow
129+
uses: actions/github-script@v7
130+
with:
131+
github-token: ${{ secrets.DEPLOY_PAT }}
132+
script: |
133+
await github.rest.actions.createWorkflowDispatch({
134+
owner: 'statisticsnorway',
135+
repo: '${{ secrets.DEPLOY_REPO }}',
136+
workflow_id: '${{ secrets.DEPLOY_WORKFLOW }}.yaml',
137+
ref: 'master',
138+
inputs: {
139+
environment: "PROD",
140+
service: "metadata-service"
141+
}
142+
})

.github/workflows/test-and-build.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,48 @@ jobs:
102102
workflow_id: '${{ secrets.INTEGRATION_TEST_WORKFLOW }}.yaml',
103103
ref: 'main'
104104
})
105+
106+
revoke:
107+
runs-on: ubuntu-latest
108+
needs: build
109+
permissions:
110+
actions: write
111+
steps:
112+
- uses: actions/checkout@v4
113+
- name: Mark older approvals as unnecessary
114+
env:
115+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116+
run: |
117+
# Find previous workflow runs for the same workflow
118+
runs=$(gh run list --workflow=87753572 --json databaseId,status --jq '.[] | select(.status == "waiting") | .databaseId')
119+
120+
for run_id in $runs; do
121+
echo "Marking workflow run $run_id as outdated"
122+
gh run cancel $run_id
123+
done
124+
125+
deploy:
126+
name: Deploy to production
127+
runs-on: ubuntu-latest
128+
needs: [build, revoke]
129+
environment: prod
130+
permissions:
131+
contents: read
132+
id-token: write
133+
134+
steps:
135+
- name: Call workflow
136+
uses: actions/github-script@v7
137+
with:
138+
github-token: ${{ secrets.DEPLOY_PAT }}
139+
script: |
140+
await github.rest.actions.createWorkflowDispatch({
141+
owner: 'statisticsnorway',
142+
repo: '${{ secrets.DEPLOY_REPO }}',
143+
workflow_id: '${{ secrets.DEPLOY_WORKFLOW }}.yaml',
144+
ref: 'master',
145+
inputs: {
146+
environment: "PROD",
147+
service: "metadata-service"
148+
}
149+
})

0 commit comments

Comments
 (0)