forked from deso-protocol/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
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
2 changed files
with
59 additions
and
53 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 |
---|---|---|
|
@@ -8,8 +8,8 @@ on: | |
push: | ||
branches: | ||
- 'main' | ||
tags: | ||
- 'v*' | ||
tags-ignore: | ||
- "*_stage" | ||
paths-ignore: | ||
- 'terraform-environments/**' | ||
pull_request: | ||
|
@@ -149,54 +149,3 @@ jobs: | |
with: | ||
commit_message: "Automated Change | Deploy to dev | tags: ${{ steps.tag_id.outputs.tag }}" | ||
file_pattern: terraform-environments/* | ||
|
||
## Deploy to stage | ||
## Will only run on a tag release: v*_stage | ||
## Will update the stage's TF file's docker tag with the tag and commit it back into the 'main' branch | ||
## This will trigger a TF run to apply the changes | ||
trigger-deploy-stage: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '_stage') | ||
steps: | ||
# Including the PERSONAL_ACCESS_TOKEN_CORE in the checkout. Without this the | ||
# following stefanzweifel/git-auto-commit-action will not trigger a | ||
# new github action for deployment | ||
# doc: https://github.com/stefanzweifel/git-auto-commit-action#commits-made-by-this-action-do-not-trigger-new-workflow-runs | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN_CORE }} | ||
ref: 'main' | ||
|
||
- name: Extract tag var | ||
id: tag_id | ||
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | ||
|
||
- name: Remove _stage | ||
id: get-tag | ||
run: | | ||
tag_val=$(echo ${{steps.tag_id.outputs.tag}} | cut -d_ -f1) | ||
echo "::set-output name=tag_val::$tag_val" | ||
# Update the docker tags in the TF/helm deployment | ||
- name: Update stage image tag | ||
uses: jacobtomlinson/[email protected] | ||
with: | ||
find: "docker_tag = \".*\"" | ||
replace: "docker_tag = \"${{ steps.get-tag.outputs.tag_val }}\"" | ||
include: "terraform-environments/aws/stage/helm/70-gem-frontend/main.tf" | ||
|
||
- name: Check output | ||
run: | | ||
echo "ref: ${{ github.ref }}" | ||
echo "head_ref: ${{ github.head_ref }}" | ||
echo "base_ref: ${{ github.base_ref }}" | ||
echo ${{ steps.get-tag.outputs.tag_val }} | ||
cat terraform-environments/aws/stage/helm/70-gem-frontend/main.tf | ||
- name: Update dev deploy docker tags file | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: "Automated Change | Deploy to stage | tags: ${{ steps.get-tag.outputs.tag_val }}" | ||
file_pattern: terraform-environments/* |
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,57 @@ | ||
# The name of the pipeline. Must be unique. | ||
name: "Stage Trigger" | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*_stage" | ||
|
||
jobs: | ||
## Deploy to stage | ||
## Will only run on a tag release: v*_stage | ||
## Will update the stage's TF file's docker tag with the tag and commit it back into the 'main' branch | ||
## This will trigger a TF run to apply the changes | ||
trigger-deploy-stage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Including the PERSONAL_ACCESS_TOKEN_CORE in the checkout. Without this the | ||
# following stefanzweifel/git-auto-commit-action will not trigger a | ||
# new github action for deployment | ||
# doc: https://github.com/stefanzweifel/git-auto-commit-action#commits-made-by-this-action-do-not-trigger-new-workflow-runs | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.PERSONAL_ACCESS_TOKEN_CORE }} | ||
ref: 'main' | ||
|
||
- name: Extract tag var | ||
id: tag_id | ||
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | ||
|
||
- name: Remove _stage | ||
id: get-tag | ||
run: | | ||
tag_val=$(echo ${{steps.tag_id.outputs.tag}} | cut -d_ -f1) | ||
echo "::set-output name=tag_val::$tag_val" | ||
# Update the docker tags in the TF/helm deployment | ||
- name: Update stage image tag | ||
uses: jacobtomlinson/[email protected] | ||
with: | ||
find: "docker_tag = \".*\"" | ||
replace: "docker_tag = \"${{ steps.get-tag.outputs.tag_val }}\"" | ||
include: "terraform-environments/aws/stage/helm/70-gem-frontend/main.tf" | ||
|
||
- name: Check output | ||
run: | | ||
echo "ref: ${{ github.ref }}" | ||
echo "head_ref: ${{ github.head_ref }}" | ||
echo "base_ref: ${{ github.base_ref }}" | ||
echo ${{ steps.get-tag.outputs.tag_val }} | ||
cat terraform-environments/aws/stage/helm/70-gem-frontend/main.tf | ||
- name: Update dev deploy docker tags file | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: "Automated Change | Deploy to stage | tags: ${{ steps.get-tag.outputs.tag_val }}" | ||
file_pattern: terraform-environments/* |