From 203587faac5090a18efda16ae0346226bb877194 Mon Sep 17 00:00:00 2001 From: tfkhdyt Date: Sat, 8 Jun 2024 09:41:08 +0700 Subject: [PATCH] ci: add AUR publish and Go binary release workflows This commit adds two new GitHub workflows to the project: - `.github/workflows/aur.yaml`: A workflow that publishes the project to the Arch User Repository (AUR). - `.github/workflows/build.yaml`: A workflow that builds and releases a Go binary for the project. The AUR publish workflow is triggered on pushes to the `master` branch that include changes to the `PKGBUILD` file. The workflow uses the `KSXGitHub/github-actions-deploy-aur` action to publish the package to the AUR. The Go binary release workflow is triggered on release creation. The workflow uses the `wangyoucao577/go-release-action` action to build and release the Go binary for the project. The workflow builds binaries for Linux, Windows, and Darwin (macOS) on both amd64 and arm64 architectures. --- .github/workflows/aur.yaml | 22 ++++++++++++++++++++++ .github/workflows/build.yaml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/aur.yaml create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/aur.yaml b/.github/workflows/aur.yaml new file mode 100644 index 0000000..d64274e --- /dev/null +++ b/.github/workflows/aur.yaml @@ -0,0 +1,22 @@ +name: Publish to AUR +on: + push: + branches: + - master + paths: + - PKGBUILD +jobs: + aur-publish: + if: github.repository_owner == 'tfkhdyt' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: KSXGitHub/github-actions-deploy-aur@v2.7.1 + with: + pkgname: urban-cli-bin + pkgbuild: ./PKGBUILD + commit_username: ${{ secrets.AUR_USERNAME }} + commit_email: ${{ secrets.AUR_EMAIL }} + ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + commit_message: Update AUR package + ssh_keyscan_types: rsa,dsa,ecdsa,ed25519 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..e540004 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,33 @@ +name: Release Go binary +on: + release: + types: [created] +permissions: + contents: write + packages: write +jobs: + release-matrix: + runs-on: ubuntu-latest + strategy: + matrix: + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + exclude: + - goarch: arm64 + goos: windows + steps: + - uses: actions/checkout@v4 + - uses: wangyoucao577/go-release-action@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: ${{ matrix.goos }} + goarch: ${{ matrix.goarch }} + ldflags: '-w -s' + executable_compression: upx + md5sum: FALSE + sha256sum: TRUE