artifactview/.forgejo/workflows/release.yaml
2024-06-22 06:13:54 +02:00

51 lines
1.9 KiB
YAML

name: Release
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: cimaster-latest
steps:
- name: 👁️ Checkout repository
uses: actions/checkout@v4
- name: ⚒️ Build application
run: |
PKG_CONFIG_SYSROOT_DIR=/usr/x86_64-linux-gnu cargo build --release --target x86_64-unknown-linux-gnu
PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu cargo build --release --target aarch64-unknown-linux-gnu
- name: 🐋 Build docker image
uses: https://code.thetadev.de/ThetaDev/action-kaniko@v1
with:
image: thetadev256/artifactview
username: thetadev256
password: ${{ secrets.DOCKER_TOKEN }}
tag: ${{ github.ref_name }}
tag_with_latest: ${{ startsWith(github.ref, 'refs/tags/v') }}
platforms: "linux/amd64,linux/arm64"
- name: Prepare release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
mkdir dist
tar -cJf dist/artifactview-x86_64-${{ github.ref_name }}.tar.xz -C target/x86_64-unknown-linux-gnu/release artifactview
tar -cJf dist/artifactview-aarch64-${{ github.ref_name }}.tar.xz -C target/aarch64-unknown-linux-gnu/release artifactview
{
echo 'CHANGELOG<<END_OF_FILE'
awk 'BEGIN{RS="(^|\n)## [^\n]+\n*"} NR==2 { print }' CHANGELOG.md
echo END_OF_FILE
} >> "$GITHUB_ENV"
- name: 🎉 Publish release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: https://gitea.com/actions/release-action@main
with:
title: "artifactview ${{ github.ref_name }}"
body: "${{ env.CHANGELOG }}"
files: dist/*
- name: 🚀 Deploy to server
run: |
curl -SsL --fail-with-body -H "Authorization: Bearer ${{ secrets.THETADEV_DE_WATCHTOWER_TOKEN }}" https://watchtower.thetadev.de/v1/update