-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(actions-bootstrap): update default actions
- Loading branch information
bootstrap-package-actions
committed
Jan 2, 2022
1 parent
0cfacf9
commit 8d95d2e
Showing
2 changed files
with
42 additions
and
87 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,104 +2,48 @@ name: pkgbuild | |
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
force-update: | ||
description: 'update artifacts' | ||
required: false | ||
default: 'false' | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
jobs: | ||
prepare: | ||
runs-on: ubuntu-20.04 | ||
name: prepare | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: check-updatable | ||
id: check | ||
run: | | ||
VERSION=$(cat PKGBUILD | grep pkgver= | sed -e 's/^pkgver=//' | awk '{print $1}')-$(cat PKGBUILD | grep pkgrel= | sed -e 's/^pkgrel=//' | awk '{print $1}') | ||
echo "ARCHITECTURES=$(cat PKGBUILD | grep arch= | sed -e 's/^arch=(\(.*\))/\1/')" >>$GITHUB_ENV | ||
echo "VERSION=${VERSION}" >>$GITHUB_ENV | ||
git fetch --tags | ||
git rev-list "${VERSION}" >/dev/null && \ | ||
echo "::set-output name=updatable::false" || \ | ||
echo "::set-output name=updatable::true" | ||
outputs: | ||
updatable: ${{ steps.check.outputs.updatable }} | ||
architectures: ${{ env.ARCHITECTURES }} | ||
version: ${{ env.VERSION }} | ||
pkgbuild: | ||
runs-on: ubuntu-20.04 | ||
name: ${{ matrix.distro }} ${{ matrix.arch }} | ||
needs: [prepare] | ||
if: ${{ needs.prepare.outputs.updatable == 'true' }} | ||
strategy: | ||
matrix: | ||
archlinux_arch: [aarch64, x86_64] | ||
include: | ||
- arch: aarch64 | ||
distro: manjaro_latest | ||
archlinux_arch: aarch64 | ||
- arch: amd64 | ||
distro: manjaro_latest | ||
archlinux_arch: x86_64 | ||
- archlinux_arch: aarch64 | ||
docker_arch: aarch64 | ||
- archlinux_arch: x86_64 | ||
docker_arch: amd64 | ||
name: pkgbuild for ${{ matrix.archlinux_arch }} | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: get-additional-gpg | ||
run: | | ||
echo "ADDITIONAL_GPG=$(cat .github/additional_gpg | sed -e ':a;N;$!ba;s/\n/ /g')" >>$GITHUB_ENV | ||
- name: any-build | ||
if: ${{ ( contains(needs.prepare.outputs.architectures, 'any') && matrix.archlinux_arch == 'x86_64' ) }} | ||
run: echo "BUILD=true" >>$GITHUB_ENV | ||
- name: arch-build | ||
if: ${{ contains(needs.prepare.outputs.architectures, matrix.archlinux_arch) }} | ||
run: echo "BUILD=true" >>$GITHUB_ENV | ||
- uses: Manjaro-Sway/run-on-arch-action@master | ||
if: ${{ env.BUILD == 'true' }} | ||
name: build | ||
id: build | ||
- uses: actions/checkout@v2 | ||
- name: pkgbuild | ||
id: pkgbuild | ||
uses: Manjaro-Sway/manjaro-package-action@main | ||
with: | ||
arch: ${{ matrix.arch }} | ||
distro: ${{ matrix.distro }} | ||
githubToken: ${{ github.token }} | ||
setup: | | ||
mkdir -p "${PWD}/artifacts" | ||
dockerRunArgs: | | ||
--volume "${PWD}/artifacts:/artifacts" | ||
--cap-add=SYS_ADMIN | ||
shell: /bin/bash | ||
install: | | ||
ADDITIONAL_GPG=$(echo ${{ env.ADDITIONAL_GPG }} | sed -e ':a;N;$!ba;s/\n/ /g') | ||
if [[ -n "$ADDITIONAL_GPG" ]]; then | ||
sudo -u builder gpg --keyserver keys.openpgp.org --recv-key $(echo ${ADDITIONAL_GPG}) | ||
pacman-key --keyserver keys.openpgp.org --recv-keys $(echo ${ADDITIONAL_GPG}) | ||
fi | ||
sed -i '/^\[core\]/i \[manjaro-sway\]\nSigLevel = PackageRequired\nServer = https://packages.manjaro-sway.download/$arch\n' /etc/pacman.conf | ||
pacman-mirrors --geoip | ||
run: | | ||
pacman -Syy | ||
chown builder $PWD | ||
sudo -u builder makepkg -fsAc --noconfirm --noprogressbar | ||
cp *.pkg.tar.zst* /artifacts/ | ||
- name: determine-filename | ||
if: ${{ env.BUILD == 'true' }} | ||
run: echo "FILE_NAME=$(basename $(find ./artifacts/ -type f \( -name "*.pkg.tar.zst" \)))" >> $GITHUB_ENV | ||
- name: sign | ||
if: ${{ env.BUILD == 'true' }} | ||
run: | | ||
# import signing key (no passphrase) | ||
cat <(echo -e "${{ secrets.GPG_SECRET_KEY_BASE64 }}" | base64 --decode) | gpg --batch --import | ||
gpg --pinentry-mode loopback --detach-sign ./artifacts/${{ env.FILE_NAME }} | ||
- name: release | ||
if: ${{ env.BUILD == 'true' }} | ||
run: | | ||
echo ${{ github.token }} | gh auth login --with-token | ||
gh release create ${{ needs.prepare.outputs.version }} --repo ${{ github.repository }} --notes "automated release" || echo "release already exists" | ||
gh release upload ${{ needs.prepare.outputs.version }} --repo ${{ github.repository }} --clobber \ | ||
./artifacts/${{ env.FILE_NAME }} ./artifacts/${{ env.FILE_NAME }}.sig | ||
- name: dispatch | ||
if: ${{ env.BUILD == 'true' }} | ||
uses: peter-evans/repository-dispatch@v1 | ||
docker_arch: ${{ matrix.docker_arch }} | ||
archlinux_arch: ${{ matrix.archlinux_arch }} | ||
gpg_keyid: ${{ secrets.GPG_KEYID }} | ||
gpg_signing_key_base64: ${{ secrets.GPG_SECRET_KEY_BASE64 }} | ||
dispatch-token: ${{ secrets.DISPATCH }} | ||
force-update: ${{ github.event.inputs.force-update }} | ||
- name: telegram | ||
if: failure() | ||
uses: appleboy/telegram-action@master | ||
with: | ||
token: ${{ secrets.DISPATCH }} | ||
repository: manjaro-sway/packages | ||
event-type: package_update | ||
client-payload: '{ "repository": "${{ github.repository }}", "version": "${{ needs.prepare.outputs.version }}", "file_name": "${{ env.FILE_NAME }}"}' | ||
to: ${{ secrets.TELEGRAM_TO }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
disable_web_page_preview: true | ||
message: | | ||
Failed to build ${{ github.repository }} for ${{ matrix.archlinux_arch }} | ||
Check pipeline: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,14 @@ jobs: | |
git config --global user.email "[email protected]" | ||
git config --global user.name "Manjaro Sway" | ||
git rebase upstream/$(git branch --show-current) && git push --force-with-lease | ||
- name: telegram | ||
if: failure() | ||
uses: appleboy/telegram-action@master | ||
with: | ||
to: ${{ secrets.TELEGRAM_TO }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
disable_web_page_preview: true | ||
message: | | ||
Failed to rebase ${{ github.repository }} onto ${UPSTREAM_GIT} | ||
Check pipeline: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} |