| 1 |
name: Create Release & Upload Assets |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
|
| 6 |
tags: |
| 7 |
- 'v*' |
| 8 |
|
| 9 |
jobs: |
| 10 |
test: |
| 11 |
name: Lint, Test, Build |
| 12 |
runs-on: ubuntu-20.04 |
| 13 |
strategy: |
| 14 |
matrix: |
| 15 |
go: [ '1.15', '1.16' ] |
| 16 |
steps: |
| 17 |
- |
| 18 |
name: Checkout |
| 19 |
uses: actions/checkout@v2 |
| 20 |
- |
| 21 |
name: Setup Go |
| 22 |
uses: actions/setup-go@v2 |
| 23 |
with: |
| 24 |
go-version: ${{ matrix.go }} |
| 25 |
- |
| 26 |
name: golangci-lint |
| 27 |
uses: golangci/golangci-lint-action@v2 |
| 28 |
with: |
| 29 |
|
| 30 |
version: 'latest' |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
args: --timeout=30m |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
- |
| 50 |
name: Test, Build |
| 51 |
id: lintTestBuild |
| 52 |
run: V=1 make ci |
| 53 |
|
| 54 |
create_release: |
| 55 |
name: Create Release |
| 56 |
needs: test |
| 57 |
runs-on: ubuntu-20.04 |
| 58 |
outputs: |
| 59 |
version: ${{ steps.extract-tag.outputs.VERSION }} |
| 60 |
vversion: ${{ steps.extract-tag.outputs.VVERSION }} |
| 61 |
is_prerelease: ${{ steps.is_prerelease.outputs.IS_PRERELEASE }} |
| 62 |
steps: |
| 63 |
- |
| 64 |
name: Extract Tag Names |
| 65 |
id: extract-tag |
| 66 |
run: | |
| 67 |
VVERSION=${GITHUB_REF#refs/tags/} |
| 68 |
VERSION=${GITHUB_REF#refs/tags/v} |
| 69 |
echo "::set-output name=VVERSION::${VVERSION}" |
| 70 |
echo "::set-output name=VERSION::${VERSION}" |
| 71 |
- |
| 72 |
name: Is Pre-release |
| 73 |
id: is_prerelease |
| 74 |
run: | |
| 75 |
set +e |
| 76 |
echo ${{ github.ref }} | grep "\-rc.*" |
| 77 |
OUT=$? |
| 78 |
if [ $OUT -eq 0 ]; then IS_PRERELEASE=true; else IS_PRERELEASE=false; fi |
| 79 |
echo "::set-output name=IS_PRERELEASE::${IS_PRERELEASE}" |
| 80 |
- |
| 81 |
name: Create Release |
| 82 |
id: create_release |
| 83 |
uses: actions/create-release@v1 |
| 84 |
env: |
| 85 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 86 |
with: |
| 87 |
tag_name: ${{ github.ref }} |
| 88 |
release_name: Release ${{ github.ref }} |
| 89 |
draft: false |
| 90 |
prerelease: ${{ steps.is_prerelease.outputs.IS_PRERELEASE }} |
| 91 |
|
| 92 |
goreleaser: |
| 93 |
name: Upload Assets to Github w/ goreleaser |
| 94 |
runs-on: ubuntu-20.04 |
| 95 |
needs: create_release |
| 96 |
steps: |
| 97 |
- |
| 98 |
name: Checkout |
| 99 |
uses: actions/checkout@v2 |
| 100 |
with: |
| 101 |
fetch-depth: 0 |
| 102 |
- |
| 103 |
name: Set up Go |
| 104 |
uses: actions/setup-go@v2 |
| 105 |
with: |
| 106 |
go-version: 1.16 |
| 107 |
- |
| 108 |
name: Run GoReleaser |
| 109 |
uses: goreleaser/goreleaser-action@56f5b77f7fa4a8fe068bf22b732ec036cc9bc13f |
| 110 |
with: |
| 111 |
version: latest |
| 112 |
args: release --rm-dist |
| 113 |
env: |
| 114 |
GITHUB_TOKEN: ${{ secrets.PAT }} |
| 115 |
|
| 116 |
release_deb: |
| 117 |
name: Build & Release Debian package |
| 118 |
runs-on: ubuntu-20.04 |
| 119 |
needs: create_release |
| 120 |
steps: |
| 121 |
- |
| 122 |
name: Checkout |
| 123 |
uses: actions/checkout@v2 |
| 124 |
with: |
| 125 |
fetch-depth: 0 |
| 126 |
- |
| 127 |
name: Set up Go |
| 128 |
uses: actions/setup-go@v2 |
| 129 |
with: |
| 130 |
go-version: 1.16 |
| 131 |
- |
| 132 |
name: APT Install |
| 133 |
id: aptInstall |
| 134 |
run: sudo apt-get -y install build-essential debhelper fakeroot |
| 135 |
- |
| 136 |
name: Build Debian package |
| 137 |
id: build |
| 138 |
run: | |
| 139 |
PATH=$PATH:/usr/local/go/bin:/home/admin/go/bin |
| 140 |
make debian |
| 141 |
- |
| 142 |
name: Upload Debian Package |
| 143 |
id: upload_deb |
| 144 |
run: | |
| 145 |
tag_name="${GITHUB_REF##*/}" |
| 146 |
hub release edit $(find ./.releases -type f -printf "-a %p ") -m "" "$tag_name" |
| 147 |
env: |
| 148 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 149 |
|
| 150 |
build_upload_docker: |
| 151 |
name: Build & Upload Docker Images |
| 152 |
runs-on: ubuntu-20.04 |
| 153 |
needs: test |
| 154 |
steps: |
| 155 |
- |
| 156 |
name: Checkout |
| 157 |
uses: actions/checkout@v2 |
| 158 |
- |
| 159 |
name: Setup Go |
| 160 |
uses: actions/setup-go@v2 |
| 161 |
with: |
| 162 |
go-version: 1.16 |
| 163 |
- |
| 164 |
name: Build |
| 165 |
id: build |
| 166 |
run: | |
| 167 |
PATH=$PATH:/usr/local/go/bin:/home/admin/go/bin |
| 168 |
make docker-artifacts |
| 169 |
env: |
| 170 |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} |
| 171 |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} |
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
build_upload_aws_s3_binaries: |
| 176 |
name: Build & Upload AWS S3 Binaries |
| 177 |
runs-on: ubuntu-20.04 |
| 178 |
needs: create_release |
| 179 |
if: needs.create_release.outputs.is_prerelease == 'false' |
| 180 |
steps: |
| 181 |
- |
| 182 |
name: Checkout |
| 183 |
uses: actions/checkout@v2 |
| 184 |
- |
| 185 |
name: Setup Go |
| 186 |
uses: actions/setup-go@v2 |
| 187 |
with: |
| 188 |
go-version: 1.16 |
| 189 |
- |
| 190 |
name: Build |
| 191 |
id: build |
| 192 |
run: | |
| 193 |
PATH=$PATH:/usr/local/go/bin:/home/admin/go/bin |
| 194 |
make -j1 binary-linux binary-darwin binary-windows |
| 195 |
mkdir -p ./.releases |
| 196 |
cp ./output/binary/linux/bin/step ./.releases/step-linux-${{ needs.create_release.outputs.version }} |
| 197 |
cp ./output/binary/linux/bin/step ./.releases/step-linux-latest-integration |
| 198 |
cp ./output/binary/darwin/bin/step ./.releases/step-darwin-${{ needs.create_release.outputs.version }} |
| 199 |
cp ./output/binary/windows/bin/step ./.releases/step-windows-${{ needs.create_release.outputs.version }}.exe |
| 200 |
- |
| 201 |
name: Upload s3 |
| 202 |
id: upload-s3 |
| 203 |
uses: jakejarvis/[email protected] |
| 204 |
with: |
| 205 |
args: --acl public-read --follow-symlinks |
| 206 |
env: |
| 207 |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} |
| 208 |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 209 |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 210 |
AWS_REGION: us-east-1 |
| 211 |
SOURCE_DIR: ./.releases |
| 212 |
|
| 213 |
upload_windows_installer: |
| 214 |
name: Upload Windows Installer |
| 215 |
runs-on: ubuntu-20.04 |
| 216 |
needs: create_release |
| 217 |
if: needs.create_release.outputs.is_prerelease == 'false' |
| 218 |
steps: |
| 219 |
- |
| 220 |
name: Checkout |
| 221 |
uses: actions/checkout@v2 |
| 222 |
- |
| 223 |
name: Modify Installer |
| 224 |
id: modify |
| 225 |
run: sed -e 's~${CLI_VERSION}~'${{ needs.create_release.outputs.version }}'~g' ./upload/install-step.ps1.tpl > ./install-step.ps1 |
| 226 |
- |
| 227 |
name: Upload and Overwrite |
| 228 |
id: upload |
| 229 |
uses: prewk/[email protected] |
| 230 |
with: |
| 231 |
args: --acl public-read --follow-symlinks |
| 232 |
env: |
| 233 |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 234 |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 235 |
AWS_REGION: us-east-1 |
| 236 |
DEST: s3://${{ secrets.AWS_s3_BUCKET }}/install-step.ps1 |
| 237 |
SOURCE: ./install-step.ps1 |
| 238 |
|
| 239 |
update_reference_docs: |
| 240 |
name: Update Reference Docs |
| 241 |
runs-on: ubuntu-20.04 |
| 242 |
needs: create_release |
| 243 |
if: needs.create_release.outputs.is_prerelease == 'false' |
| 244 |
steps: |
| 245 |
- |
| 246 |
name: Checkout |
| 247 |
uses: actions/checkout@v2 |
| 248 |
- |
| 249 |
name: Setup Go |
| 250 |
uses: actions/setup-go@v2 |
| 251 |
with: |
| 252 |
go-version: 1.16 |
| 253 |
- |
| 254 |
name: Build |
| 255 |
id: build |
| 256 |
run: V=1 make build |
| 257 |
- |
| 258 |
name: Checkout Docs |
| 259 |
uses: actions/checkout@master |
| 260 |
with: |
| 261 |
repository: smallstep/docs |
| 262 |
token: ${{ secrets.PAT }} |
| 263 |
path: './docs' |
| 264 |
- |
| 265 |
name: Update Reference |
| 266 |
id: update_refrence |
| 267 |
run: | |
| 268 |
./bin/step help --markdown ./docs/step-cli/reference |
| 269 |
cd ./docs |
| 270 |
git config user.email "[email protected]" |
| 271 |
git config user.name "Github Action CI" |
| 272 |
git commit -a -m "step-cli ${{ needs.create_release.outputs.vversion }} reference update" |
| 273 |
- |
| 274 |
name: Push changes |
| 275 |
uses: ad-m/[email protected] |
| 276 |
with: |
| 277 |
github_token: ${{ secrets.PAT }} |
| 278 |
branch: 'master' |
| 279 |
directory: './docs' |
| 280 |
repository: 'smallstep/docs' |