Skip to content

0.25.5

0.25.5 #71

Workflow file for this run

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/[email protected]
- 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/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/[email protected]
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"