Skip to content

Commit a3413e5

Browse files
authored
support to push release via oras (#462)
Signed-off-by: rick <[email protected]> Co-authored-by: rick <[email protected]>
1 parent 7bd1d82 commit a3413e5

File tree

1 file changed

+11
-49
lines changed

1 file changed

+11
-49
lines changed

.github/workflows/release.yaml

Lines changed: 11 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ jobs:
1313
steps:
1414
- name: Checkout
1515
uses: actions/[email protected]
16+
with:
17+
fetch-tags: true
18+
fetch-depth: 0
19+
- name: Set output
20+
id: vars
21+
run: echo "tag=$(git describe --tags)" >> $GITHUB_OUTPUT
1622
- name: Unshallow
1723
run: git fetch --prune --unshallow
1824
- name: Set up Go
@@ -22,7 +28,7 @@ jobs:
2228
- name: Image Registry Login
2329
run: |
2430
docker login --username ${{ secrets.DOCKER_HUB_USER }} --password ${{secrets.DOCKER_HUB_TOKEN}}
25-
docker login ghcr.io/linuxsuren --username linuxsuren --password ${{secrets.GH_PUBLISH_SECRETS}}
31+
docker login ${{ env.REGISTRY }/linuxsuren --username linuxsuren --password ${{secrets.GH_PUBLISH_SECRETS}}
2632
- name: Run GoReleaser
2733
uses: goreleaser/[email protected]
2834
with:
@@ -31,6 +37,10 @@ jobs:
3137
args: release --rm-dist
3238
env:
3339
GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }}
40+
- name: Upload via oras
41+
run: |
42+
oras push docker.io/linuxsuren/hd:$GITHUB_OUTPUT release
43+
oras push ${{ env.REGISTRY }/linuxsuren/hd:$GITHUB_OUTPUT release
3444
3545
image:
3646
runs-on: ubuntu-20.04
@@ -66,51 +76,3 @@ jobs:
6676
cache-from: type=gha
6777
cache-to: type=gha,mode=max
6878
build-args: VERSION=${{ steps.vars.outputs.tag }}
69-
70-
msi:
71-
needs: goreleaser
72-
runs-on: windows-latest
73-
steps:
74-
- name: Checkout
75-
uses: actions/[email protected]
76-
- name: Download hd.exe
77-
id: download_exe
78-
shell: bash
79-
run: |
80-
hub release download "${GITHUB_REF#refs/tags/}" -i '*windows-amd64*.zip'
81-
printf "::set-output name=zip::%s\n" *.zip
82-
unzip -o *.zip && rm -v *.zip
83-
env:
84-
GITHUB_TOKEN: ${{secrets.GH_PUBLISH_SECRETS}}
85-
- name: Install go-msi
86-
run: choco install -y "go-msi"
87-
- name: Prepare PATH
88-
shell: bash
89-
run: |
90-
echo "$WIX\\bin" >> $GITHUB_PATH
91-
echo "C:\\Program Files\\go-msi" >> $GITHUB_PATH
92-
- name: Build MSI
93-
id: buildmsi
94-
shell: bash
95-
env:
96-
ZIP_FILE: ${{ steps.download_exe.outputs.zip }}
97-
run: |
98-
mkdir -p build
99-
msi="$(basename "$ZIP_FILE" ".zip").msi"
100-
printf "::set-output name=msi::%s\n" "$msi"
101-
go-msi make --msi "$PWD/$msi" --out "$PWD/build" --version "${GITHUB_REF#refs/tags/}"
102-
- name: Upload MSI
103-
shell: bash
104-
run: |
105-
tag_name="${GITHUB_REF#refs/tags/}"
106-
hub release edit "$tag_name" -m "" -a "$MSI_FILE"
107-
release_url="$(gh api repos/:owner/:repo/releases -q ".[]|select(.tag_name==\"${tag_name}\")|.url")"
108-
publish_args=( -F draft=false )
109-
if [[ $GITHUB_REF != *-* ]]; then
110-
publish_args+=( -f discussion_category_name="$DISCUSSION_CATEGORY" )
111-
fi
112-
gh api -X PATCH "$release_url" "${publish_args[@]}"
113-
env:
114-
MSI_FILE: ${{ steps.buildmsi.outputs.msi }}
115-
DISCUSSION_CATEGORY: General
116-
GITHUB_TOKEN: ${{secrets.GH_PUBLISH_SECRETS}}

0 commit comments

Comments
 (0)