-
Notifications
You must be signed in to change notification settings - Fork 1
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
9 changed files
with
49 additions
and
59 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 |
---|---|---|
|
@@ -5,6 +5,10 @@ on: | |
PERSONAL_ACCESS_TOKEN: | ||
required: true | ||
inputs: | ||
image_tag: | ||
description: Tag for the image for docker/ghcr registries | ||
required: true | ||
type: string | ||
deployment_environment: | ||
description: The terraform target environment | ||
required: true | ||
|
@@ -13,26 +17,16 @@ on: | |
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
env: | ||
GIT_SHA: ${{ github.sha }} | ||
GIT_TAG: ${{ inputs.image_tag }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Extract variables | ||
shell: bash | ||
run: | | ||
echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_OUTPUT | ||
echo "TAG=$(git tag --points-at HEAD)" >> $GITHUB_OUTPUT | ||
echo "GIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | ||
echo "GIT_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | ||
id: extract_variables | ||
|
||
- name: Checkout terraform config repo | ||
uses: actions/checkout@v3 | ||
with: | ||
# public repo with terraform configuration | ||
repository: 'datacite/mastino' | ||
persist-credentials: false | ||
|
||
- name: Setup dockerize and template parameters | ||
# use go template in terraform config repository to update git sha and tag | ||
# commit and push changes to trigger terraform workflow | ||
|
@@ -42,27 +36,20 @@ jobs: | |
wget https://github.com/jwilder/dockerize/releases/download/v0.6.0/dockerize-linux-amd64-v0.6.0.tar.gz | ||
tar -xzvf dockerize-linux-amd64-v0.6.0.tar.gz | ||
rm dockerize-linux-amd64-v0.6.0.tar.gz | ||
- name: Conditionally update staging environment | ||
if: ${{ (inputs.deployment_environment == 'staging') }} | ||
run: | | ||
export GIT_SHA=${{ steps.extract_variables.outputs.GIT_SHA_SHORT }} | ||
export GIT_TAG=${{ steps.extract_variables.outputs.GIT_TAG }} | ||
./dockerize -template stage/services/mds/_poodle.auto.tfvars.tmpl:stage/services/mds/_poodle.auto.tfvars | ||
git add stage/services/mds/_poodle.auto.tfvars | ||
git commit -m "Adding poodle git variables for commit ${{ steps.extract_variables.outputs.GIT_SHA }}" | ||
- name: Conditionally update production/test environments | ||
if: ${{ (inputs.deployment_environment == 'production') }} | ||
run: | | ||
export GIT_SHA=${{ steps.extract_variables.outputs.GIT_SHA_SHORT }} | ||
export GIT_TAG=${{ steps.extract_variables.outputs.GIT_TAG }} | ||
./dockerize -template prod-eu-west/services/mds/_poodle.auto.tfvars.tmpl:prod-eu-west/services/mds/_poodle.auto.tfvars | ||
./dockerize -template test/services/mds/_poodle.auto.tfvars.tmpl:test/services/mds/_poodle.auto.tfvars | ||
git add prod-eu-west/services/mds/_poodle.auto.tfvars | ||
git add test/services/mds/_poodle.auto.tfvars | ||
git commit -m "Adding poodle git variables for tag ${{ steps.extract_variables.outputs.GIT_TAG }}" | ||
- name: Push changes | ||
uses: ad-m/[email protected] | ||
with: | ||
|
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: Reset Staging to Main Branch | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
deploy: | ||
uses: ./.github/workflows/_update_terraform.yml | ||
with: | ||
image_tag: main | ||
deployment_environment: staging | ||
secrets: inherit |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: Test Branch | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
test: | ||
uses: ./.github/workflows/ci.yml | ||
secrets: inherit | ||
|