Build #21
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- fix-build-workflow | |
jobs: | |
release: | |
name: Build | |
runs-on: ubuntu-22.04 | |
steps: | |
################################################### | |
# | |
# Prepare | |
# | |
################################################### | |
- name: (PREPARE) Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: (PREPARE) Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: (PREPARE) Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.15.0 | |
cache: yarn | |
- name: (PREPARE) Install Dependencies | |
run: rm -rf node_modules && yarn --immutable | |
################################################### | |
# | |
# Build | |
# | |
################################################### | |
- name: (DOCS) Generate Dependencies Page | |
run: yarn docs:generate:dependencies | |
- name: (BUILD) Build Project | |
run: yarn build | |
- name: (BUILD) Setup Packaging Cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.pkg-cache | |
key: pkg | |
- name: (BUILD) Package Binaries | |
run: yarn package | |
- name: (BUILD) Import Signing Key | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.VINTNER_RELEASE_PRIVATE_KEY }} | |
- name: (BUILD) Sign Binaries | |
run: | | |
cd dist | |
for BINARY in vintner-alpine-x64 vintner-linux-arm64 vintner-linux-x64 vintner-win-x64.exe | |
do | |
gpg --no-tty --detach-sign -a --local-user vintner-release ${BINARY} | |
done | |
- name: (BUILD) Compress Binaries | |
run: | | |
cd dist | |
for BINARY in vintner-alpine-x64 vintner-linux-arm64 vintner-linux-x64 vintner-win-x64.exe | |
do | |
tar -cJf ${BINARY}.xz ${BINARY} | |
done | |
################################################### | |
# | |
# Release | |
# | |
################################################### | |
- name: (RELEASE) Delete Build Release | |
run: gh release delete build-${GITHUB_SHA} --cleanup-tag --yes || true | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: (RELEASE) Delete Build Tag (Local) | |
run: git tag --delete build-${GITHUB_SHA} || true | |
- name: (RELEASE) Create Build Release (and Tag) | |
run: gh release create build-${GITHUB_SHA} -t "Build ${GITHUB_SHA}" -n "This is the build of the commit ${GITHUB_SHA}" ./dist/* | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
################################################### | |
# | |
# Docker | |
# | |
################################################### | |
- name: (DOCKER) Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: (DOCKER) Log in to the container registry | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: (DOCKER) Build and push Docker image | |
uses: docker/[email protected] | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/opentosca/opentosca-vintner:${{ github.sha }} | |
cache-from: type=registry,ref=ghcr.io/opentosca/opentosca-vintner:buildcache | |
cache-to: type=registry,ref=ghcr.io/opentosca/opentosca-vintner:buildcache,mode=max |