dhbw-abb-typst-template/.gitea/workflows/release.yml

80 lines
2.5 KiB
YAML
Raw Normal View History

2024-11-25 08:10:49 +00:00
name: Build'n check
on:
2024-11-25 09:10:33 +00:00
pull_request:
2024-11-25 08:10:49 +00:00
branches:
- main
2024-11-25 09:10:33 +00:00
types:
- closed
2024-11-25 08:10:49 +00:00
jobs:
build:
name: Check Template and Build example
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install dependencies for Nix setup action
run: |
apt update -y
apt install sudo -y
- name: Setup Nix
uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Stylecheck
run: nix-shell --run "./run-fmt.sh --check src/lib.typ"
- id: build
name: Build
run: |
nix-shell --run ./run-ci.sh
- name: Upload artifact
id: artifact-upload
uses: actions/upload-artifact@v3
2024-11-25 08:10:49 +00:00
with:
name: example-document
path: ${{ github.workspace }}/example.pdf
if-no-files-found: error
retention-days: 1
- name: Output artifact ID
run: echo 'Artifact ID is ${{ steps.artifact-upload.outputs.artifact-id }}'
release:
runs-on: ubuntu-latest
needs: build
if: contains(github.event.head_commit.message, 'Release-As:')
env:
USERNAME: servostar
2024-11-25 08:10:49 +00:00
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '>=1.20.1'
2024-11-25 08:11:31 +00:00
- name: Download Artifact
2024-11-25 08:10:49 +00:00
id: download
uses: actions/download-artifact@v3
2024-11-25 08:10:49 +00:00
with:
name: example-document
path: ${{ github.workspace }}/Example.pdf
- name: 'Artifact Download Path'
run: echo ${{ steps.download.outputs.download-path }}
- name: Prepare Release
run: echo ${{ github.sha }} > Release.txt
2024-11-25 09:11:11 +00:00
- name: Tag Release Commit
run: |
echo ${{github.event.head_commit.message}} | grep -Po '(?<=Release-As: )v\d+\.\d+\.\d+' > Version.txt
echo "==> Tagging for version: $(cat Version.txt)"
git config --global credential.helper store
echo "https://${USERNAME}:${{secrets.RELEASE_TOKEN}}}@${{github.repositoryUrl}}" > ~/.git-credentials
git tag -m "Release" $(cat Version.txt)
git push ${{github.repositoryUrl}} $(cat Version.txt)
2024-11-25 08:10:49 +00:00
- name: Create release
id: create-release
uses: https://gitea.com/actions/release-action@main
with:
files: |-
Example.pdf
Release.txt
2024-11-25 09:11:11 +00:00
Version.txt
2024-11-25 08:10:49 +00:00
LICENSE
api_key: '${{secrets.RELEASE_TOKEN}}'