File: release.yml

package info (click to toggle)
golang-github-smallstep-cli 0.15.16%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,404 kB
  • sloc: sh: 512; makefile: 99
file content (280 lines) | stat: -rw-r--r-- 8,463 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
name: Create Release & Upload Assets

on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
    - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
  test:
    name: Lint, Test, Build
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        go: [ '1.15', '1.16' ]
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go }}
      -
        name: golangci-lint
        uses: golangci/golangci-lint-action@v2
        with:
          # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
          version: 'latest'

          # Optional: working directory, useful for monorepos
          # working-directory: somedir

          # Optional: golangci-lint command line arguments.
          args: --timeout=30m

          # Optional: show only new issues if it's a pull request. The default value is `false`.
          # only-new-issues: true

          # Optional: if set to true then the action will use pre-installed Go.
          # skip-go-installation: true

          # Optional: if set to true then the action don't cache or restore ~/go/pkg.
          # skip-pkg-cache: true

          # Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
          # skip-build-cache: true
      -
        name: Test, Build
        id: lintTestBuild
        run: V=1 make ci

  create_release:
    name: Create Release
    needs: test
    runs-on: ubuntu-20.04
    outputs:
      version: ${{ steps.extract-tag.outputs.VERSION }}
      vversion: ${{ steps.extract-tag.outputs.VVERSION }}
      is_prerelease: ${{ steps.is_prerelease.outputs.IS_PRERELEASE }}
    steps:
      -
        name: Extract Tag Names
        id: extract-tag
        run: |
          VVERSION=${GITHUB_REF#refs/tags/}
          VERSION=${GITHUB_REF#refs/tags/v}
          echo "::set-output name=VVERSION::${VVERSION}"
          echo "::set-output name=VERSION::${VERSION}"
      -
        name: Is Pre-release
        id: is_prerelease
        run: |
          set +e
          echo ${{ github.ref }} | grep "\-rc.*"
          OUT=$?
          if [ $OUT -eq 0 ]; then IS_PRERELEASE=true; else IS_PRERELEASE=false; fi
          echo "::set-output name=IS_PRERELEASE::${IS_PRERELEASE}"
      -
        name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          draft: false
          prerelease: ${{ steps.is_prerelease.outputs.IS_PRERELEASE }}

  goreleaser:
    name: Upload Assets to Github w/ goreleaser
    runs-on: ubuntu-20.04
    needs: create_release
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      -
        name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.16
      -
        name: Run GoReleaser
        uses: goreleaser/goreleaser-action@56f5b77f7fa4a8fe068bf22b732ec036cc9bc13f # v2.4.1
        with:
          version: latest
          args: release --rm-dist
        env:
          GITHUB_TOKEN: ${{ secrets.PAT }}

  release_deb:
    name: Build & Release Debian package
    runs-on: ubuntu-20.04
    needs: create_release
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      -
        name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.16
      -
        name: APT Install
        id: aptInstall
        run: sudo apt-get -y install build-essential debhelper fakeroot
      -
        name: Build Debian package
        id: build
        run: |
          PATH=$PATH:/usr/local/go/bin:/home/admin/go/bin
          make debian
      -
        name: Upload Debian Package
        id: upload_deb
        run: |
          tag_name="${GITHUB_REF##*/}"
          hub release edit $(find ./.releases -type f -printf "-a %p ") -m "" "$tag_name"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  build_upload_docker:
    name: Build & Upload Docker Images
    runs-on: ubuntu-20.04
    needs: test
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.16
      -
        name: Build
        id: build
        run: |
          PATH=$PATH:/usr/local/go/bin:/home/admin/go/bin
          make docker-artifacts
        env:
          DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
          DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

# All jobs below this are for full releases (non release candidates e.g. *-rc.*)

  build_upload_aws_s3_binaries:
    name: Build & Upload AWS S3 Binaries
    runs-on: ubuntu-20.04
    needs: create_release
    if: needs.create_release.outputs.is_prerelease == 'false'
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.16
      -
        name: Build
        id: build
        run: |
          PATH=$PATH:/usr/local/go/bin:/home/admin/go/bin
          make -j1 binary-linux binary-darwin binary-windows
          mkdir -p ./.releases
          cp ./output/binary/linux/bin/step ./.releases/step-linux-${{ needs.create_release.outputs.version }}
          cp ./output/binary/linux/bin/step ./.releases/step-linux-latest-integration
          cp ./output/binary/darwin/bin/step ./.releases/step-darwin-${{ needs.create_release.outputs.version }}
          cp ./output/binary/windows/bin/step ./.releases/step-windows-${{ needs.create_release.outputs.version }}.exe
      -
        name: Upload s3
        id: upload-s3
        uses: jakejarvis/s3-sync-action@v0.5.1
        with:
          args: --acl public-read --follow-symlinks
        env:
          AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_REGION: us-east-1
          SOURCE_DIR: ./.releases

  upload_windows_installer:
    name: Upload Windows Installer
    runs-on: ubuntu-20.04
    needs: create_release
    if: needs.create_release.outputs.is_prerelease == 'false'
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Modify Installer
        id: modify
        run: sed -e 's~${CLI_VERSION}~'${{ needs.create_release.outputs.version }}'~g' ./upload/install-step.ps1.tpl > ./install-step.ps1
      -
        name: Upload and Overwrite
        id: upload
        uses: prewk/s3-cp-action@v0.1.1
        with:
          args: --acl public-read --follow-symlinks
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          AWS_REGION: us-east-1
          DEST: s3://${{ secrets.AWS_s3_BUCKET }}/install-step.ps1
          SOURCE: ./install-step.ps1

  update_reference_docs:
    name: Update Reference Docs
    runs-on: ubuntu-20.04
    needs: create_release
    if: needs.create_release.outputs.is_prerelease == 'false'
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.16
      -
        name: Build
        id: build
        run: V=1 make build
      -
        name: Checkout Docs
        uses: actions/checkout@master
        with:
          repository: smallstep/docs
          token: ${{ secrets.PAT }}
          path: './docs'
      -
        name: Update Reference
        id: update_refrence
        run: |
          ./bin/step help --markdown ./docs/step-cli/reference
          cd ./docs
          git config user.email "eng@smallstep.com"
          git config user.name "Github Action CI"
          git commit -a -m "step-cli ${{ needs.create_release.outputs.vversion }} reference update"
      -
        name: Push changes
        uses: ad-m/github-push-action@v0.6.0
        with:
          github_token: ${{ secrets.PAT }}
          branch: 'master'
          directory: './docs'
          repository: 'smallstep/docs'