0.25.4 #70
Workflow file for this run
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
name: Release Action | |
on: | |
release: | |
types: | |
- published | |
concurrency: | |
group: '${{ github.workflow }}' | |
cancel-in-progress: true | |
jobs: | |
deploy_conainer: | |
name: Deploy Container | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.2.1 | |
- name: Get version number | |
id: version | |
run: | | |
version=$(echo "${{ github.ref }}" | awk -F"/" '{print $NF}' ) | |
echo "::set-output name=version::$version" | |
- name: Populate version.json | |
run: | | |
hash=$(git rev-parse HEAD) | |
echo "{\"version\": {\"hash\": \"$hash\", \"version\": \"${{ steps.version.outputs.version }}\"}}" > ./version.json | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3.3.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6.9.0 | |
with: | |
context: . | |
push: true | |
tags: "ghcr.io/${{ github.repository_owner }}/service-hub:${{ steps.version.outputs.version }}" | |
- name: Update Terraform variable set | |
run: | | |
variable_id=$(curl -sSL \ | |
--header "Authorization: Bearer ${{ secrets.TERRAFORM_CLOUD_TOKEN }}" \ | |
--header "Content-Type: application/vnd.api+json" \ | |
--request GET \ | |
https://app.terraform.io/api/v2/varsets/${{ secrets.TERRAFORM_CLOUD_VARSET_ID }} \ | |
| jq -r '.data.relationships.vars.data[0] | .id') | |
curl -sSL \ | |
--header "Authorization: Bearer ${{ secrets.TERRAFORM_CLOUD_TOKEN }}" \ | |
--header "Content-Type: application/vnd.api+json" \ | |
--request PATCH \ | |
--data '{"data": {"type": "vars", "attributes": {"value": "${{ steps.version.outputs.version }}"}}}' \ | |
"https://app.terraform.io/api/v2/varsets/${{ secrets.TERRAFORM_CLOUD_VARSET_ID }}/relationships/vars/$variable_id" |