Skip to content

Commit

Permalink
ci(packages): move upload-test to its own step
Browse files Browse the repository at this point in the history
Move setting environment variables from run into env
  • Loading branch information
truboxl authored and Grimler91 committed Dec 11, 2024
1 parent c14012d commit 319035b
Showing 1 changed file with 43 additions and 16 deletions.
59 changes: 43 additions & 16 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,10 @@ jobs:
name: debs-${{ matrix.target_arch }}-${{ github.sha }}
path: ./artifacts

upload:
concurrency: ${{ github.workflow }}
upload-test:
permissions:
contents: read
if: github.repository == 'termux/termux-packages'
if: github.repository == 'termux/termux-packages' && github.ref != 'refs/heads/master'
needs: build
runs-on: ubuntu-latest
steps:
Expand All @@ -278,15 +277,18 @@ jobs:
uses: actions/download-artifact@v4
with:
path: ./
- name: Upload to packages.termux.dev
env:
REPOSITORY_URL: https://packages.termux.dev/aptly-api
- name: Check packages using Packages.bz2
run: |
GITHUB_SHA=${{ github.sha }}
APTLY_API_AUTH=${{ secrets.APTLY_API_AUTH }}
GPG_PASSPHRASE=${{ secrets.GPG_PASSPHRASE }}
source scripts/aptly_api.sh
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
# GitHub sometimes add merge commits at the end
# To prevent user confusion, filter them with --no-merges
# Process tag '%ci:no-build' that may be added as line to commit message.
# Forces CI to cancel current build with status 'passed'
if grep -qiP '^\s*%ci:no-build\s*$' <(git log --format="%B" -n 1 --no-merges "HEAD"); then
echo "[!] Force exiting as tag '%ci:no-build' was applied to HEAD commit message."
exit 0
fi
fi
for archive in debs-*/debs-{aarch64,arm,i686,x86_64}-${{ github.sha }}.tar; do
tar xf "$archive"
Expand Down Expand Up @@ -317,18 +319,43 @@ jobs:
fi
result=$(find debs -maxdepth 1 -type f | cut -d"/" -f2 | xargs -P$(nproc) -i{} grep "^Filename:.*/{}$" -nH "Packages-${repo}-${arch}" || true)
if [ -n "$result" ]; then
echo "[!] Found local files same name with server files! Please revbump package or tag commit with '%ci:no-build'"
if [ "$error" = 0 ]; then
echo "[!] Found local files same name with server files!"
echo "[!] Please revbump package, rebase or tag commit with '%ci:no-build'"
fi
echo "$result" | grep -E "${arch}|all" || true
error=1
fi
done
done
if [ "$error" != 0 ]; then exit 1; fi
if [ "${{ github.ref }}" != "refs/heads/master" ]; then
echo "[!] Not on master branch. Cancelling upload."
exit 0
fi
upload:
concurrency: ${{ github.workflow }}
permissions:
contents: read
if: github.repository == 'termux/termux-packages' && github.ref == 'refs/heads/master'
needs: build
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Get *.deb files
uses: actions/download-artifact@v4
with:
path: ./
- name: Upload to packages.termux.dev
env:
REPOSITORY_URL: https://packages.termux.dev/aptly-api
GITHUB_SHA: ${{ github.sha }}
APTLY_API_AUTH: ${{ secrets.APTLY_API_AUTH }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
source scripts/aptly_api.sh
for archive in debs-*/debs-{aarch64,arm,i686,x86_64}-${{ github.sha }}.tar; do
tar xf "$archive"
done
for repo in $(jq --raw-output 'del(.pkg_format) | keys | .[]' repo.json); do
export REPOSITORY_NAME=$(jq --raw-output '.["'$repo'"].name' repo.json)
Expand Down

0 comments on commit 319035b

Please sign in to comment.