|
13 | 13 | steps: |
14 | 14 | - name: Checkout |
15 | 15 | |
| 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 |
16 | 22 | - name: Unshallow |
17 | 23 | run: git fetch --prune --unshallow |
18 | 24 | - name: Set up Go |
|
22 | 28 | - name: Image Registry Login |
23 | 29 | run: | |
24 | 30 | 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}} |
26 | 32 | - name: Run GoReleaser |
27 | 33 | uses: goreleaser/[email protected] |
28 | 34 | with: |
|
31 | 37 | args: release --rm-dist |
32 | 38 | env: |
33 | 39 | 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 |
34 | 44 |
|
35 | 45 | image: |
36 | 46 | runs-on: ubuntu-20.04 |
|
66 | 76 | cache-from: type=gha |
67 | 77 | cache-to: type=gha,mode=max |
68 | 78 | build-args: VERSION=${{ steps.vars.outputs.tag }} |
69 | | - |
70 | | - msi: |
71 | | - needs: goreleaser |
72 | | - runs-on: windows-latest |
73 | | - steps: |
74 | | - - name: Checkout |
75 | | - |
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