Compare commits

...

2 commits

Author SHA1 Message Date
0f573de3e4
ci: split workflow into CI and Release 2024-06-22 05:57:59 +02:00
cd31673569
ci: add Artifactview PR comment 2024-06-22 05:53:48 +02:00
3 changed files with 57 additions and 47 deletions

View file

@ -1,6 +1,8 @@
name: CI
on:
push:
branches:
- "main"
pull_request:
jobs:
@ -25,50 +27,7 @@ jobs:
with:
name: test
path: target/nextest/ci/junit.xml
release:
runs-on: cimaster-latest
needs: test
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: 👁️ Checkout repository
uses: actions/checkout@v4
- name: ⚒️ Build application
- name: 🔗 Artifactview PR comment
if: ${{ always() && github.event_name == 'pull_request' }}
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 -s -H "Authorization: Bearer ${{ secrets.THETADEV_DE_WATCHTOWER_TOKEN }}" https://watchtower.thetadev.de/v1/update
curl -X POST https://av.thetadev.de/.well-known/api/prComment -H "Content-Type: application/json" --data "{\"url\": \"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\", \"pr\": ${{ github.event.number }}, \"artifact_titles\": {\"test\":\"🧪 Test report\"}}"

View file

@ -0,0 +1,51 @@
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 -s -H "Authorization: Bearer ${{ secrets.THETADEV_DE_WATCHTOWER_TOKEN }}" https://watchtower.thetadev.de/v1/update

View file

@ -82,7 +82,7 @@ artifacts).
- name: 🔗 Artifactview PR comment
if: ${{ always() && github.event_name == 'pull_request' }}
run: |
curl -X POST https://av.thetadev.de/.well-known/api/prComment -H "Content-Type: application/json" --data "{\"url\": \"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\", pr: ${{ github.event.number }}}"
curl -X POST https://av.thetadev.de/.well-known/api/prComment -H "Content-Type: application/json" --data "{\"url\": \"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\", \"pr\": ${{ github.event.number }}}"
```
## API