fix(build): Auto apply for apt-get #79
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: Build | |
on: | |
push: | |
branches: | |
- '**' | |
paths-ignore: | |
- '.github/dependabot.yml' | |
- 'static/**' | |
- 'README.md' | |
env: | |
semantic_version: '19.0.5' | |
jobs: | |
ci: | |
name: Application Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Getting next release version | |
id: semantic | |
uses: cycjimmy/semantic-release-action@v4 | |
with: | |
dry_run: true | |
semantic_version: ${{ env.semantic_version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test | |
run: | | |
sudo apt-get install -y uuid-dev uuid-runtime | |
make test | |
- name: Build AMD64 binary | |
uses: docker/build-push-action@v5 | |
if: github.ref == 'refs/heads/main' | |
with: | |
tags: result:amd64 | |
platforms: linux/amd64 | |
file: .github/workflows/Dockerfile | |
build-args: | | |
VERSION=${{ steps.semantic.outputs.new_release_version }} | |
load: true | |
push: false | |
- name: Build ARM v7 binary | |
uses: docker/build-push-action@v5 | |
if: github.ref == 'refs/heads/main' | |
with: | |
tags: result:arm-v7 | |
platforms: linux/arm/v7 | |
file: .github/workflows/Dockerfile | |
build-args: | | |
VERSION=${{ steps.semantic.outputs.new_release_version }} | |
load: true | |
push: false | |
- name: Extract results | |
if: github.ref == 'refs/heads/main' | |
run: | | |
for arch in amd64 arm-v7; do | |
id=$(docker create result:$arch) | |
docker cp $id:/build/samler samler.$arch | |
docker rm -v $id | |
file samler.$arch | |
done | |
- name: Create Release | |
if: github.ref == 'refs/heads/main' && steps.semantic.outputs.new_release_version != null | |
uses: cycjimmy/semantic-release-action@v4 | |
with: | |
semantic_version: ${{ env.semantic_version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add artifacts to release | |
uses: softprops/action-gh-release@v2 | |
if: github.ref == 'refs/heads/main' && steps.semantic.outputs.new_release_version != null | |
with: | |
tag_name: v${{ steps.semantic.outputs.new_release_version }} | |
files: | | |
samler.amd64 | |
samler.arm-v7 |