-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,71 @@ | ||
name: "Update Image Manifests in Staging" | ||
name: Update docker image for manifests in staging | ||
|
||
on: | ||
on: | ||
workflow_dispatch: | ||
# push: | ||
# branches: | ||
# - main | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
tag-release: | ||
update-image: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Obtain a Notify PR Bot GitHub App Installation Access Token | ||
run: | | ||
TOKEN="$(npx [email protected] ci ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_STAGING }})" | ||
echo "::add-mask::$TOKEN" | ||
echo "GITHUB_TOKEN=$TOKEN" >> $GITHUB_ENV | ||
- name: Checkout branch | ||
uses: actions/checkout@v3 | ||
|
||
- name: Checkout target repository | ||
uses: actions/checkout@v2 | ||
with: | ||
token: ${{ env.GITHUB_TOKEN }} | ||
|
||
- name: Update version file | ||
run: | | ||
echo "Updating docker tag in staging.env" | ||
sed -i 's/^ADMIN_DOCKER_TAG:.*/ADMIN_DOCKER_TAG: ${GITHUB_SHA::7}/' z.env | ||
repository: cds-snc/notification-manifests | ||
token: ${{ secrets.PR_BOT_MANIFEST_STAGING }} | ||
path: notification-manifests | ||
ref: main | ||
|
||
- name: Setup git config | ||
run: | | ||
git config user.name "Notify PR Bot" | ||
git config user.email "[email protected]" | ||
- name: Make changes to the file | ||
run: | | ||
echo "Updating docker tag in staging.env" | ||
sed -i 's/^ADMIN_DOCKER_TAG:.*/ADMIN_DOCKER_TAG: ${GITHUB_SHA::7}/' notification-manifests/helmfile/overrides/staging.env | ||
- name: Branch protection OFF | ||
uses: octokit/[email protected] | ||
with: | ||
route: PUT /repos/:repository/branches/main/protection | ||
repository: ${{ github.repository }} | ||
repository: cds-snc/notification-manifests | ||
required_status_checks: null | ||
required_linear_history: null | ||
enforce_admins: null | ||
required_pull_request_reviews: null | ||
restrictions: null | ||
env: | ||
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.PR_BOT_MANIFEST_STAGING }} | ||
|
||
- name: Commit | ||
run: | | ||
git add VERSION | ||
git commit -m "New image tag ${GITHUB_SHA::7}" | ||
git push origin helm-tagging | ||
git add notification-manifests/helmfile/overrides/staging.env | ||
git commit -m "Update Admin docker image tag to ${GITHUB_SHA::7}" | ||
git push | ||
- name: Branch protection ON | ||
if: always() | ||
uses: octokit/[email protected] | ||
with: | ||
route: PUT /repos/:repository/branches/main/protection | ||
repository: ${{ github.repository }} | ||
required_status_checks: null | ||
required_status_checks: | | ||
strict: true | ||
checks: | ||
- context: testing_manifest | ||
required_linear_history: true | ||
enforce_admins: true | ||
required_pull_request_reviews: null | ||
required_pull_request_reviews: | | ||
required_approving_review_count: 1 | ||
restrictions: null | ||
env: | ||
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.PR_BOT_MANIFEST_STAGING }} |