@@ -19,6 +19,7 @@ permissions:
1919
2020jobs :
2121 build-and-push-image :
22+ name : docker buildx pkgxdev/pkgx:${{ github.event.release.tag_name || github.event.inputs.tag }}
2223 runs-on : ubuntu-latest
2324 steps :
2425 - uses : robinraju/release-downloader@v1.11
2728 tag : ${{ github.event.inputs.tag }}
2829 fileName : pkgx-*.tar.xz
2930
31+ - name : is_latest?
32+ id : latest
33+ run : |
34+ TAG_NAME="${{ github.event.release.tag_name || github.event.inputs.tag }}"
35+ LATEST_RELEASE=$(gh api repos/${{ github.repository }}/releases/latest --jq '.tag_name')
36+ if [ "$TAG_NAME" == "$LATEST_RELEASE" ]; then
37+ echo "value=true" >> "${GITHUB_OUTPUT}"
38+ else
39+ echo "value=false" >> "${GITHUB_OUTPUT}"
40+ fi
41+ env :
42+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43+
3044 - name : Unpack Binaries
3145 run : |
3246 for filename in pkgx-*+*+*.tar.xz; do
@@ -41,19 +55,14 @@ jobs:
4155 mv linux+x86-64 products/x86_64
4256 mv linux+aarch64 products/aarch64
4357
44- curl -o products/pkgm https://pkgxdev.github.io/pkgm/pkgm.ts
58+ - name : Load `pkgm`
59+ run : curl -o products/pkgm https://pkgxdev.github.io/pkgm/pkgm.ts
60+ if : ${{ startsWith(2, github.event.release.tag_name || github.event.inputs.tag) }}
4561
4662 - uses : actions/checkout@v4
4763 with :
4864 path : src
4965
50- - name : log in to github pkgs
51- uses : docker/login-action@v3
52- with :
53- registry : ghcr.io
54- username : ${{ github.actor }}
55- password : ${{ github.token }}
56-
5766 - name : log in to docker hub
5867 uses : docker/login-action@v3
5968 with :
@@ -63,16 +72,14 @@ jobs:
6372 - uses : docker/metadata-action@v5
6473 id : meta
6574 with :
66- images :
67- ghcr.io/${{ github.repository }}
68- pkgxdev/pkgx
75+ images : pkgxdev/pkgx
76+ flavor : |
77+ latest=${{ steps.latest.outputs.value }}
6978 tags : |
7079 type=sha
71- type=ref,event=branch
72- type=semver,pattern=v{{version}}
73- type=semver,pattern=v{{major}}.{{minor}}
74- type=semver,pattern=v{{major}}
75- type=raw,value=latest
80+ type=semver,pattern=v{{version}},value=${{ github.event.release.tag_name || github.event.inputs.tag }}
81+ type=semver,pattern=v{{major}}.{{minor}},value=${{ github.event.release.tag_name || github.event.inputs.tag }}
82+ type=semver,pattern=v{{major}},value=${{ github.event.release.tag_name || github.event.inputs.tag }}
7683
7784 - uses : docker/setup-qemu-action@v3
7885 - uses : docker/setup-buildx-action@v3
8794 $tags \
8895 --platform linux/amd64,linux/arm64 \
8996 --file ./src/.github/Dockerfile \
90- .
97+ .
0 commit comments