| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- 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' ]
- outputs:
- is_prerelease: ${{ steps.is_prerelease.outputs.IS_PRERELEASE }}
- steps:
- -
- name: Checkout
- uses: actions/checkout@v2
- -
- name: Setup Go
- uses: actions/setup-go@v2
- with:
- go-version: ${{ matrix.go }}
- -
- name: Install Deps
- id: install-deps
- run: sudo apt-get -y install libpcsclite-dev
- -
- 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: lint_test_build
- run: V=1 make ci
- create_release:
- name: Create Release
- needs: test
- runs-on: ubuntu-20.04
- outputs:
- is_prerelease: ${{ steps.is_prerelease.outputs.IS_PRERELEASE }}
- steps:
- -
- 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 & Upload Debian Package To Github
- 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 }}
|