Skip to content

Commit

Permalink
update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
doums committed Aug 11, 2024
1 parent 1f22ded commit a4e177e
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 28 deletions.
66 changes: 44 additions & 22 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,62 +13,84 @@ jobs:
name: Build
runs-on: ubuntu-latest
needs: test
env:
ARTIFACT_DIR: artifact
outputs:
sha256: ${{ steps.gen_sha256.outputs.sha256 }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: sudo apt-get install libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libpulse-dev
- name: Build
run: cargo build --release --locked
- name: Upload binary artifact
uses: actions/upload-artifact@v3
- name: Prepare artifact
run: |
mkdir $ARTIFACT_DIR
mv -f target/release/baru $ARTIFACT_DIR/
- name: Gen sha256
id: gen_sha256
working-directory: ${{ env.ARTIFACT_DIR }}
run: |
sha256=$(sha256sum baru)
echo "$sha256"
echo "sha256=$sha256" >> "$GITHUB_OUTPUT"
echo "$sha256" > baru.sha256sum
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: baru
path: ./target/release/baru
path: ${{ env.ARTIFACT_DIR }}
retention-days: 2

gh-release:
name: Publish Github Release
release:
name: Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
env:
SHA256: ${{ needs.build.outputs.sha256 }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download binary artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: baru
path: ./target/release/
- name: Release
uses: softprops/action-gh-release@v1
- name: Integrity check
run: |
sha256sum -c baru.sha256sum
[ "$SHA256" == "$(cat baru.sha256sum)" ] && echo "sha256 OK"
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: target/release/baru
files: |
baru
baru.sha256sum
aur-packaging:
name: Publish AUR package
needs: gh-release
needs: release
runs-on: ubuntu-latest
env:
PKG_NAME: baru
PKGNAME: baru
PKGBUILD: ./.pkg/aur/PKGBUILD
RELEASE_TAG: ${{ github.ref_name }}
REPOSITORY: ${{ github.repository }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Download sources
run: curl -LfsSo "$PKG_NAME-$RELEASE_TAG".tar.gz "https://github.com/$REPOSITORY/archive/refs/tags/$RELEASE_TAG.tar.gz"
run: curl -LfsSo "$PKGNAME-$RELEASE_TAG".tar.gz "https://github.com/$REPOSITORY/archive/refs/tags/$RELEASE_TAG.tar.gz"
- name: Update PKGBUILD
run: ./.pkg/aur/update.sh
- name: Show PKGBUILD
run: cat "$PKGBUILD"
- name: Publish
uses: KSXGitHub/github-actions-deploy-aur@v2.6.0
uses: KSXGitHub/github-actions-deploy-aur@v2.7.2
with:
pkgname: ${{ env.PKG_NAME }}
pkgname: ${{ env.PKGNAME }}
pkgbuild: ${{ env.PKGBUILD }}
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy
- name: Install dependencies
run: sudo apt-get install libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libpulse-dev
Expand Down
1 change: 1 addition & 0 deletions .pkg/aur/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ depends=('libpulse')
makedepends=('rust' 'cargo')
provides=('baru')
conflicts=('baru')
options=(!debug)
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('xxx')

Expand Down
6 changes: 3 additions & 3 deletions .pkg/aur/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ if [ -z "$PKGBUILD" ]; then
exit 1
fi

if [ -z "$PKG_NAME" ]; then
>&2 printf " %b%b✕%b PKG_NAME not set\n" "$red" "$bold" "$reset"
if [ -z "$PKGNAME" ]; then
>&2 printf " %b%b✕%b PKGNAME not set\n" "$red" "$bold" "$reset"
exit 1
fi

Expand All @@ -35,7 +35,7 @@ if ! [[ "$RELEASE_TAG" =~ ^v.*? ]]; then
fi

pkgver="${RELEASE_TAG#v}"
tarball="$PKG_NAME-$RELEASE_TAG".tar.gz
tarball="$PKGNAME-$RELEASE_TAG".tar.gz

if ! [ -a "$tarball" ]; then
>&2 printf " %b%b✕%b no such file $tarball\n" "$red" "$bold" "$reset"
Expand Down

0 comments on commit a4e177e

Please sign in to comment.