feat: setup semantic release #47
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 | |
on: | |
push: | |
branches: | |
- semrel | |
jobs: | |
build-test-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Define environment variables | |
run: echo IMAGE_NAME=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Important for Semantic Release to analyze all commits | |
- name: Set up Docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build container | |
uses: docker/build-push-action@v5 | |
with: | |
file: Dockerfile.test | |
tags: ${{ env.IMAGE_NAME }}:pre-semver | |
load: true | |
cache-from: ${{ env.IMAGE_NAME }}:latest | |
- name: Run tests | |
run: docker run ${{ env.IMAGE_NAME }}:pre-semver curl --version | |
- name: Semantic release | |
uses: cycjimmy/semantic-release-action@v4 | |
id: semantic | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.semantic.outputs.new_release_git_tag }} | |
- name: Login to GitHub container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build container | |
uses: docker/build-push-action@v5 | |
with: | |
file: Dockerfile.test | |
tags: | | |
${{ env.IMAGE_NAME }}:latest | |
${{ env.IMAGE_NAME }}:${{ steps.semantic.outputs.new_release_version }} | |
push: true | |
cache-from: ${{ env.IMAGE_NAME }}:pre-semver |