Skip to content

fix(ci): pin go-semantic-release action to real v1.24.1 SHA #138

fix(ci): pin go-semantic-release action to real v1.24.1 SHA

fix(ci): pin go-semantic-release action to real v1.24.1 SHA #138

Workflow file for this run

on:
push:
branches:
- master
- develop
permissions:
contents: write
packages: write
jobs:
version:
runs-on: ubuntu-latest
outputs:
versionOut: ${{ steps.out.outputs.version }}
published: ${{ steps.semrel.outputs.new-release-published }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Semantic release
id: semrel
if: github.ref == 'refs/heads/master'
uses: go-semantic-release/action@2e9dc4247a6004f8377781bef4cb9dad273a741f # v1.24.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
allow-initial-development-versions: false
changelog-generator-opt: "emojis=true"
- name: Fallback develop version
id: dev
if: github.ref != 'refs/heads/master'
run: echo "version=0.0.0-develop-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- name: Emit version
id: out
run: |
if [ "${{ steps.semrel.outputs.new-release-published }}" = "true" ]; then
echo "version=${{ steps.semrel.outputs.new-release-version }}" >> "$GITHUB_OUTPUT"
else
echo "version=${{ steps.dev.outputs.version }}" >> "$GITHUB_OUTPUT"
fi
goreleaser:
runs-on: ubuntu-latest
needs: version
if: github.ref == 'refs/heads/master' && needs.version.outputs.published == 'true'
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
ref: v${{ needs.version.outputs.versionOut }}
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: go.mod
cache: true
- uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
backend:
strategy:
matrix:
include:
- arch: linux-amd64
runner: ubuntu-latest
- arch: linux-arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
needs:
- version
if: needs.version.outputs.versionOut != '' && (github.ref != 'refs/heads/master' || needs.version.outputs.published == 'true')
env:
DOCKER_SERVER_IMAGE_NAME: "ghcr.io/${{ github.repository }}/temp-backend:${{needs.version.outputs.versionOut}}-${{ matrix.arch }}"
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- run: VERSION=${{needs.version.outputs.versionOut}} COMMIT_SHA=${GITHUB_SHA::7} make build-docker
- run: docker push ${DOCKER_SERVER_IMAGE_NAME}
backend-multi-arch:
runs-on: ubuntu-latest
needs:
- backend
- version
env:
DOCKER_SERVER_IMAGE_NAME: "ghcr.io/${{ github.repository }}/go-money-server:${{needs.version.outputs.versionOut}}"
DOCKER_SERVER_TEMP_IMAGE_NAME: "ghcr.io/${{ github.repository }}/temp-backend:${{needs.version.outputs.versionOut}}"
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Create and push manifest
run: |
docker manifest create ${DOCKER_SERVER_IMAGE_NAME} \
--amend ${DOCKER_SERVER_TEMP_IMAGE_NAME}-linux-amd64 \
--amend ${DOCKER_SERVER_TEMP_IMAGE_NAME}-linux-arm64
docker manifest push ${DOCKER_SERVER_IMAGE_NAME}
frontend:
runs-on: ubuntu-latest
container: node:24-alpine
needs:
- version
if: needs.version.outputs.versionOut != '' && (github.ref != 'refs/heads/master' || needs.version.outputs.published == 'true')
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install and build frontend
working-directory: frontend
run: npm install && npm run build
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
compression-level: '6'
path: frontend/dist/go-money
overwrite: 'true'
retention-days: 1
name: 'go-money-browser'
full:
strategy:
matrix:
include:
- arch: linux-amd64
runner: ubuntu-latest
- arch: linux-arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
needs:
- backend
- frontend
- version
- backend-multi-arch
env:
DOCKER_SERVER_IMAGE_NAME: "ghcr.io/${{ github.repository }}/go-money-server:${{needs.version.outputs.versionOut}}"
DOCKER_FULL_IMAGE_NAME: "ghcr.io/${{ github.repository }}/temp-full:${{needs.version.outputs.versionOut}}-${{ matrix.arch }}"
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download frontend artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: go-money-browser
- run: ls
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- run: docker build -f ./build/Dockerfile.full --build-arg MAIN_IMAGE=${DOCKER_SERVER_IMAGE_NAME} -t ${DOCKER_FULL_IMAGE_NAME} .
- run: docker push ${DOCKER_FULL_IMAGE_NAME}
full-multi-arch:
runs-on: ubuntu-latest
needs:
- full
- version
env:
DOCKER_FULL_IMAGE_NAME: "ghcr.io/${{ github.repository }}/go-money-full"
DOCKER_FULL_IMAGE_NAME_LATEST: "ghcr.io/${{ github.repository }}/go-money-full:latest"
DOCKER_TEMP_FULL_IMAGE_NAME: "ghcr.io/${{ github.repository }}/temp-full:${{needs.version.outputs.versionOut}}"
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Create and push manifest
env:
BRANCH_NAME: ${{ github.ref_name }}
VERSION_TAG: ${{ needs.version.outputs.versionOut }}
run: |
TAGS=("develop")
if [ "$BRANCH_NAME" = "master" ]; then
TAGS=("$VERSION_TAG" "latest")
else
TAGS=("develop")
fi
for TAG in "${TAGS[@]}"; do
FULL_TAG="${DOCKER_FULL_IMAGE_NAME}:${TAG}"
docker manifest create "${FULL_TAG}" \
"${DOCKER_TEMP_FULL_IMAGE_NAME}-linux-amd64" \
"${DOCKER_TEMP_FULL_IMAGE_NAME}-linux-arm64"
docker manifest push "${FULL_TAG}"
done
helm:
needs:
- version
- full-multi-arch
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
- name: Configure Git
run: |
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: 'gh-pages'
fetch-depth: '0'
path: 'gh-pages-dir'
- name: replace versions
env:
DOCKER_IMAGE_VERSION: ${{needs.version.outputs.versionOut}}
HELM_CHART_VERSION: ${{ needs.version.outputs.versionOut }}
TARGET_ENV: ${{needs.target-env.outputs.targetEnv}}
CHART_FOLDER: "helm"
run: |
echo $HELM_CHART_VERSION
echo $DOCKER_IMAGE_VERSION
sed -i 's/tag:.*$/tag:\ '"${DOCKER_IMAGE_VERSION}"'/' $CHART_FOLDER/values.yaml
sed -i 's/appVersion:.*$/appVersion:\ '\""$DOCKER_IMAGE_VERSION"\"'/' $CHART_FOLDER/Chart.yaml
sed -i 's/^version:.*$/version:\ '"$HELM_CHART_VERSION"'/' $CHART_FOLDER/Chart.yaml
echo "New Chart.yaml"
cat $CHART_FOLDER/Chart.yaml
echo "New values.yaml"
cat $CHART_FOLDER/values.yaml
- name: release
env:
CHART_FOLDER: "helm"
HELM_CHART_VERSION: ${{ needs.version.outputs.versionOut }}
run: |
helm package $CHART_FOLDER -d gh-pages-dir
cd gh-pages-dir
helm repo index .
git add .
git commit -m "Release chart version $HELM_CHART_VERSION"
git push origin gh-pages