mirror of
https://github.com/AlexMacocian/quick-visor.git
synced 2026-07-15 15:09:32 +00:00
85 lines
2.6 KiB
YAML
85 lines
2.6 KiB
YAML
name: Release & Publish to AUR
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
check-version:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.version.outputs.version }}
|
|
tag_exists: ${{ steps.check_tag.outputs.exists }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Read version
|
|
id: version
|
|
run: echo "version=$(cat VERSION | tr -d '[:space:]')" >> $GITHUB_OUTPUT
|
|
|
|
- name: Check if tag exists
|
|
id: check_tag
|
|
run: |
|
|
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
|
|
echo "exists=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "exists=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: check-version
|
|
if: needs.check-version.outputs.tag_exists == 'false'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Create tag
|
|
run: |
|
|
git config user.name "github-actions"
|
|
git config user.email "github-actions@github.com"
|
|
git tag "v${{ needs.check-version.outputs.version }}"
|
|
git push origin "v${{ needs.check-version.outputs.version }}"
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: "v${{ needs.check-version.outputs.version }}"
|
|
generate_release_notes: true
|
|
|
|
aur-publish:
|
|
runs-on: ubuntu-latest
|
|
needs: [check-version, release]
|
|
if: needs.check-version.outputs.tag_exists == 'false'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Compute source checksum
|
|
id: checksum
|
|
run: |
|
|
VERSION=${{ needs.check-version.outputs.version }}
|
|
curl -sL "https://github.com/${{ github.repository }}/archive/v${VERSION}.tar.gz" -o source.tar.gz
|
|
echo "sha256=$(sha256sum source.tar.gz | cut -d' ' -f1)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Generate PKGBUILD from template
|
|
run: |
|
|
sed -e 's/{{VERSION}}/${{ needs.check-version.outputs.version }}/g' \
|
|
-e 's/{{SHA256}}/${{ steps.checksum.outputs.sha256 }}/g' \
|
|
PKGBUILD.template > PKGBUILD
|
|
|
|
- name: Publish to AUR
|
|
uses: KSXGitHub/github-actions-deploy-aur@v4.1.2
|
|
with:
|
|
pkgname: quick-visor
|
|
pkgbuild: ./PKGBUILD
|
|
commit_username: Alex Macocian
|
|
commit_email: amacocian@yahoo.com
|
|
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
|
commit_message: "Update to ${{ needs.check-version.outputs.version }}"
|
|
force_push: true
|