Files
fingerprint-chromium/.gitea/workflows/publish.yml
T
rogee 72b5e78e26
Build and publish image / image (push) Successful in 2m13s
HH-686: associate OCI package with repository (#2)
2026-08-26 18:55:32 +08:00

44 lines
1.7 KiB
YAML

name: Build and publish image
on:
pull_request:
push:
branches: [main]
schedule:
- cron: "17 3 * * *"
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check scripts
run: ./tests/check.sh
- name: Log in to Gitea registry
if: gitea.event_name != 'pull_request'
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.ipao.vip --username "${{ gitea.actor }}" --password-stdin
- name: Build image
env:
OCI_REVISION: ${{ gitea.sha }}
OCI_SOURCE: https://git.ipao.vip/rogee/fingerprint-chromium
PUSH: ${{ gitea.event_name != 'pull_request' }}
run: ./scripts/build.sh git.ipao.vip/rogee/fingerprint-chromium
- name: Link package to repository
if: gitea.event_name != 'pull_request'
env:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
package_api=https://git.ipao.vip/api/v1/packages/rogee/container/fingerprint-chromium
linked_repo="$(curl --fail --silent --show-error --header "Authorization: token $REGISTRY_TOKEN" "$package_api/-/latest" | jq -r '.repository.full_name // empty')"
if [ "$linked_repo" != rogee/fingerprint-chromium ]; then
curl --fail --silent --show-error --request POST \
--header "Authorization: token $REGISTRY_TOKEN" \
"$package_api/-/link/fingerprint-chromium"
fi
test "$(curl --fail --silent --show-error --header "Authorization: token $REGISTRY_TOKEN" "$package_api/-/latest" | jq -r '.repository.full_name // empty')" = rogee/fingerprint-chromium