Bump golang.org/x/crypto from 0.20.0 to 0.21.0 (#95) #252
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: [ main ] | |
tags: | |
'v*' | |
pull_request: | |
branches: [ main ] | |
jobs: | |
# This is a super hacky way to get this into a place that can actually be | |
# used by downstream jobs because YAML values don't allow shell | |
# interpolation, only github expression interpolation | |
store-sha8: | |
name: Store The Short Hash | |
runs-on: ubuntu-latest | |
outputs: | |
sha8: ${{ steps.calc-short.outputs.sha8 }} | |
steps: | |
- name: Calculate Short Hash | |
id: calc-short | |
run: echo "::set-output name=sha8::${GITHUB_SHA::8}" | |
build: | |
name: Build | |
needs: [store-sha8] | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
go-version: ["1.20"] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set artifact name | |
run: echo "name=aterm-${{ needs.store-sha8.outputs.sha8 }}-$(uname -s | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
id: go | |
- name: Install go tools | |
run: | | |
go install golang.org/x/lint/golint@latest | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Build Repo | |
run: go build -v ./... | |
- name: gofmt | |
run: | | |
GOFMTOUT=$(gofmt -l .) | |
if [[ ! -z "${GOFMTOUT}" ]]; then | |
echo "FATAL: gofmt violation(s), please fix" | |
echo $GOFMTOUT | |
exit -1 | |
fi | |
- name: go vet | |
run: go vet ./... | |
- name: golint | |
run: golint ./... | |
- name: Test | |
run: go test -v ./... | |
- name: Build Executable | |
run: | | |
go build -o cmd/aterm/aterm -ldflags "-X github.com/jrozner/go-info.version=${GITHUB_REF} -X github.com/jrozner/go-info.commitHash=${GITHUB_SHA} -X github.com/jrozner/go-info.buildDate=$(date -u +'%Y-%m-%dT%H:%M:%SZ') -X github.com/theparanoids/aterm/cmd/aterm/config.codeRepoRaw=${GITHUB_REPOSITORY}" cmd/aterm/*.go | |
- name: package | |
run: | | |
mkdir dist | |
cp cmd/aterm/aterm dist/ | |
cp cmd/aterm/example.config.yaml dist/config.yaml | |
cp LICENSE dist/LICENSE | |
cp README.md dist/README.md | |
- name: Import Code-Signing Certificates | |
if: | | |
matrix.os == 'macos-latest' && | |
(contains(github.ref, 'tags/v') || github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release')) | |
uses: Apple-Actions/[email protected] | |
with: | |
p12-file-base64: ${{ secrets.MACOS_CERT }} | |
p12-password: ${{ secrets.MACOS_PASS }} | |
- name: Install gon via HomeBrew and Notarize (mac) | |
if: | | |
matrix.os == 'macos-latest' && | |
(contains(github.ref, 'tags/v') || github.ref == 'refs/heads/main' || contains(github.ref, 'refs/heads/release')) | |
env: | |
GON_CONF: ${{ secrets.GON_CONF }} | |
run: | | |
brew tap mitchellh/gon | |
brew install mitchellh/gon/gon | |
echo "$GON_CONF" | base64 -D -i - > notarize.json | |
gon notarize.json | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.name }} | |
path: dist | |
release: | |
name: Create GitHub Release | |
if: contains(github.ref, 'tags/v') | |
needs: [store-sha8, build] | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
steps: | |
- name: Create Release | |
id: create-release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
publish: | |
if: contains(github.ref, 'tags/v') | |
needs: [store-sha8, build, release] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: [darwin, linux] | |
steps: | |
- name: Set Version | |
run: echo "version=$(echo ${{ github.ref }} | cut -d'/' -f3 | cut -c2-)" >> $GITHUB_ENV | |
- name: Download Previous Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: aterm-${{ needs.store-sha8.outputs.sha8 }}-${{ matrix.platform }} | |
path: aterm-${{ env.version }}-${{ matrix.platform }} | |
- name: Produce Zip | |
run: zip -r aterm-${{ env.version }}-${{ matrix.platform }}.zip aterm-${{ env.version }}-${{ matrix.platform }} | |
- name: Upload Release Asset | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: aterm-${{ env.version }}-${{ matrix.platform }}.zip | |
asset_name: aterm-${{ env.version }}-${{ matrix.platform }}.zip | |
asset_content_type: application/zip |