Update PKGBUILD #49
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 and Release package | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Extract package name and version from PKGBUILD | |
id: extract_pkginfo | |
run: | | |
pkgname=$(source ./PKGBUILD && echo $pkgname) | |
pkgver=$(source ./PKGBUILD && echo $pkgver) | |
echo "pkgname=$pkgname" >> $GITHUB_ENV | |
echo "pkgver=$pkgver" >> $GITHUB_ENV | |
- name: Build package | |
id: makepkg | |
uses: CachyOS/pkgbuild-action@master | |
with: | |
envvars: "CFLAGS=-march=goldmont-plus" | |
pkgdir: "." # Assuming your PKGBUILD is in the root | |
makepkgArgs: "--skipchecksums --skippgpcheck --noconfirm -s" | |
- name: Upload package artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.pkgname }} | |
path: "*.pkg.tar.*" # Adjust the path if necessary | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "${{ env.pkgname }}-v${{ env.pkgver }}-${{ github.run_number }}" # Use a unique tag name | |
release_name: "Release ${{ env.pkgname }}-v${{ env.pkgver }}" # Use a more descriptive release name | |
body: "Automated build for ${{ env.pkgname }} version ${{ env.pkgver }} (commit ${{ github.sha }})" | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "*.pkg.tar.*" # Update the path to match the artifact | |
asset_name: ${{ env.pkgname }}-v${{ env.pkgver }}.pkg.tar.* | |
asset_content_type: application/octet-stream |