104 lines
3.3 KiB
YAML
104 lines
3.3 KiB
YAML
on:
|
|
workflow-dispatch:
|
|
push:
|
|
paths-ignore:
|
|
- "*.md"
|
|
- "**/*.md"
|
|
- ".gitlab-ci.yml"
|
|
- ".gitignore"
|
|
- "renovate.json"
|
|
- "debian/**"
|
|
- "docker/**"
|
|
- "docs/**"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: alpine:edge
|
|
|
|
steps:
|
|
- name: set up dependencies
|
|
run: |
|
|
apk update
|
|
apk upgrade
|
|
apk add nodejs git alpine-sdk curl
|
|
|
|
- name: cache alpine repo
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
/var/cache/apk
|
|
key: alpine-cache
|
|
|
|
- uses: actions/checkout@v4
|
|
name: checkout the alpine dir
|
|
with:
|
|
sparse-checkout: "alpine/"
|
|
|
|
# - uses: actions/checkout@v4
|
|
# name: checkout the rest in the alpine dir
|
|
# with:
|
|
# path: 'alpine/continuwuity'
|
|
- name: set up user
|
|
run: adduser -DG abuild ci
|
|
|
|
- name: set up keys
|
|
run: |
|
|
pwd
|
|
mkdir ~/.abuild
|
|
echo "${{ secrets.abuild_privkey }}" > ~/.abuild/ci@continuwuity.rsa
|
|
echo "${{ secrets.abuild_pubkey }}" > ~/.abuild/ci@continuwuity.rsa.pub
|
|
echo $HOME
|
|
echo 'PACKAGER_PRIVKEY="/root/.abuild/ci@continuwuity.rsa"' > ~/.abuild/abuild.conf
|
|
ls ~/.abuild
|
|
cp /root/.abuild/*.rsa.pub /etc/apk/keys
|
|
|
|
- name: go go gadget abuild
|
|
run: |
|
|
cd alpine
|
|
# modify the APKBUILD to use the current branch instead of the release
|
|
# note that it seems to require the repo to be public (as you'll get
|
|
# a 404 even if the token is provided)
|
|
# export ARCHIVE_URL="https:${{ github.repository }}/archive/${{ github.ref_name }}.tar.gz"
|
|
export ARCHIVE_URL="${{ github.server_url }}/${{ github.repository }}/archive/${{ github.ref_name }}.tar.gz"
|
|
export COMMIT_DATE=$(date -d @$(git show --no-patch --format=%ct HEAD) +%Y%m%d%H%M)
|
|
echo $ARCHIVE_URL $COMMIT_DATE
|
|
|
|
# modify the APKBUILD to use the git archive tarball and version
|
|
#
|
|
sed -i '/^source=/c\source="'"$ARCHIVE_URL" APKBUILD
|
|
sed -i "/^pkgver=/s/$/_git${COMMIT_DATE}/" APKBUILD
|
|
env
|
|
abuild -F checksum
|
|
abuild -FrK
|
|
|
|
# - name: Cache Rust registry
|
|
# uses: actions/cache@v3
|
|
# with:
|
|
# path: |
|
|
# .cargo/git
|
|
# .cargo/git/checkouts
|
|
# .cargo/registry
|
|
# .cargo/registry/src
|
|
# key: rust-registry-image-${{hashFiles('**/Cargo.lock') }}
|
|
# - name: Cache cargo target
|
|
# id: cache-cargo-target
|
|
# uses: actions/cache@v3
|
|
# with:
|
|
# path: |
|
|
# cargo-target-${{ matrix.slug }}
|
|
# key: cargo-target-${{ matrix.slug }}-${{hashFiles('**/Cargo.lock') }}-${{steps.rust-toolchain.outputs.rustc_version}}
|
|
|
|
|
|
- name: upload to registry
|
|
run: |
|
|
curl --header 'Authorization: token ${{ secrets.FORGEJO_TOKEN }}' \
|
|
--upload-file /root/packages/**/**/*.apk \
|
|
${{ env.GITHUB_API_URL }}/packages/${{ env.GITHUB_REPOSITORY_OWNER }}/alpine/edge/git
|
|
# - name: 'debug state on failure (note: only for local testing)'
|
|
# if: always()
|
|
# run: |
|
|
# env | tee /tmp/env
|
|
# sleep 1d || true
|
|
|