Release the package automatically on push to main
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# Release the pacman package on every push to main that changes the extension
|
||||
# or its package build, the same way `make release` does locally. CoreDesktop's
|
||||
# update installs it from the [federated] repo.
|
||||
#
|
||||
# Needs an Actions secret named PACKAGE_TOKEN (repo or Federated_Computer org):
|
||||
# a Gitea token with "package: Read and write" scope.
|
||||
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "coredesktop@federated.computer/**"
|
||||
- "build-aux/arch/PKGBUILD"
|
||||
# Run it by hand from the Actions tab, e.g. after changing the secret
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
# makepkg needs Arch. The image has no Node, so this job doesn't use
|
||||
# actions/checkout and clones with git instead.
|
||||
container:
|
||||
image: archlinux:base-devel
|
||||
steps:
|
||||
- name: Install git
|
||||
run: pacman -Syu --noconfirm --needed git
|
||||
|
||||
# makepkg refuses to run as root
|
||||
- name: Add a build user
|
||||
run: useradd --create-home builder
|
||||
|
||||
- name: Build and upload
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
||||
REPO_URL: ${{ github.server_url }}/${{ github.repository }}.git
|
||||
SHA: ${{ github.sha }}
|
||||
# A re-run for a commit that's already released succeeds
|
||||
RELEASE_EXISTING_OK: "1"
|
||||
# runuser without -l keeps this environment, GITEA_TOKEN included
|
||||
run: |
|
||||
runuser -u builder -- bash -euc '
|
||||
cd ~
|
||||
git clone --quiet "$REPO_URL" repo
|
||||
git -C repo checkout --quiet "$SHA"
|
||||
bash repo/build-aux/arch/release.sh
|
||||
'
|
||||
Reference in New Issue
Block a user