Debian Codegraph @

.github/workflows/releases.yml

raw symbols SCIP
1 on:
2 push:
3 paths:
4 - "**.go"
5 - "go.*"
6 - "**/testdata/**"
7 - ".ci/**"
8 - ".git*"
9 - ".github/workflows/releases.yml"
10 pull_request:
11 paths:
12 - "**.go"
13 - "go.*"
14 - "**/testdata/**"
15 - ".ci/**"
16 - ".git*"
17 - ".github/workflows/releases.yml"
18
19 name: GitHub CI
20
21 permissions:
22 contents: write
23
24 jobs:
25 build:
26 name: Build
27 runs-on: ubuntu-latest
28 steps:
29 - name: Get the version
30 id: get_version
31 env:
32 GITHUB_REF: ${{ github.ref }}
33 GITHUB_SHA: ${{ github.sha }}
34 run: |
35 if [[ $GITHUB_REF == refs/tags/* ]]; then
36 VERSION=${GITHUB_REF/refs\/tags\//}
37 else
38 VERSION="dev-$(date +'%Y%m%d-%H%M%S')-${GITHUB_SHA::8}"
39 fi
40 echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
41 echo "Tag version: $VERSION"
42
43 - name: Check out code
44 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
45 with:
46 persist-credentials: false
47
48 - name: Set up Go
49 uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
50 with:
51 go-version: 1
52 check-latest: true
53 cache: false
54 id: go
55
56 - name: Test suite
57 run: |
58 go version
59 cd .ci
60 ./ci-test.sh
61 cd -
62
63 - name: Build all
64 env:
65 VERSION: ${{ steps.get_version.outputs.VERSION }}
66 run: |
67 .ci/ci-build.sh "$VERSION"
68
69 - name: Package
70 env:
71 VERSION: ${{ steps.get_version.outputs.VERSION }}
72 run: |
73 .ci/ci-package.sh "$VERSION"
74
75 - name: Install minisign and sign
76 if: startsWith(github.ref, 'refs/tags/')
77 env:
78 MINISIGN_SK: ${{ secrets.MINISIGN_SK }}
79 run: |
80 sudo apt-get -y install libsodium-dev
81 MINISIGN_COMMIT=03ebc0dafb08a77e0548e9cbc4668a3588128de5 # 0.12
82 git init minisign
83 git -C minisign remote add origin https://github.com/jedisct1/minisign.git
84 git -C minisign fetch --depth 1 origin "$MINISIGN_COMMIT"
85 git -C minisign checkout --detach "$MINISIGN_COMMIT"
86 cd minisign/src
87 mkdir -p /tmp/bin
88 cc -O2 -o /tmp/bin/minisign -D_GNU_SOURCE *.c -lsodium
89 cd -
90 /tmp/bin/minisign -v
91 echo '#' > /tmp/minisign.key
92 echo "$MINISIGN_SK" >> /tmp/minisign.key
93 cd dnscrypt-proxy
94 echo | /tmp/bin/minisign -s /tmp/minisign.key -Sm *.tar.gz *.zip
95 ls -l dnscrypt-proxy*
96
97 - name: Upload artifacts
98 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
99 with:
100 name: dnscrypt-proxy-${{ steps.get_version.outputs.VERSION }}
101 path: |
102 dnscrypt-proxy/*.zip
103 dnscrypt-proxy/*.tar.gz
104 retention-days: 30
105 if-no-files-found: error
106
107 - name: Check if release exists
108 id: check_release
109 if: startsWith(github.ref, 'refs/tags/')
110 env:
111 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112 GH_REF: ${{ github.ref }}
113 GH_REPO: ${{ github.repository }}
114 run: |
115 TAG="${GH_REF#refs/tags/}"
116 HTTP_CODE=$(curl -s -o response.json -w "%{http_code}" \
117 -H "Authorization: token $GH_TOKEN" \
118 "https://api.github.com/repos/$GH_REPO/releases/tags/$TAG")
119 if [ "$HTTP_CODE" = "200" ]; then
120 echo "release_exists=true" >> "$GITHUB_ENV"
121 else
122 echo "release_exists=false" >> "$GITHUB_ENV"
123 fi
124
125 - name: Debug Release Existence
126 if: startsWith(github.ref, 'refs/tags/')
127 env:
128 RELEASE_EXISTS: ${{ env.release_exists }}
129 run: echo "Release exists? $RELEASE_EXISTS"
130
131 - name: Create release and upload assets
132 id: create_release
133 uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
134 if: startsWith(github.ref, 'refs/tags/') && env.release_exists == 'false'
135 env:
136 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137 with:
138 name: Release ${{ github.ref }}
139 draft: false
140 prerelease: false
141 make_latest: true
142 fail_on_unmatched_files: false
143 files: |
144 dnscrypt-proxy/*.zip
145 dnscrypt-proxy/*.tar.gz
146 dnscrypt-proxy/*.minisig
147 dnscrypt-proxy/*.msi
148
149 - name: Upload assets to existing release
150 id: upload_to_existing_release
151 uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
152 if: startsWith(github.ref, 'refs/tags/') && env.release_exists == 'true'
153 env:
154 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155 with:
156 tag_name: ${{ steps.get_version.outputs.VERSION }}
157 fail_on_unmatched_files: false
158 files: |
159 dnscrypt-proxy/*.zip
160 dnscrypt-proxy/*.tar.gz
161 dnscrypt-proxy/*.minisig
162 dnscrypt-proxy/*.msi