Enable automatic releases

This commit is contained in:
Daniel Carrillo 2021-11-16 19:29:45 +01:00
parent 7bc95f98c8
commit 97b3245278
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16
2 changed files with 23 additions and 11 deletions

View File

@ -12,12 +12,12 @@ jobs:
tests: tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2.4.0
- name: install go - name: install go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.17 go-version: "^1.17"
- name: Lint - name: Lint
run: make lint run: make lint
@ -31,10 +31,11 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
strategy: strategy:
matrix: matrix:
goos: [linux] goosarch: [linux-amd64]
goarch: [amd64]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2.4.0
with:
fetch-depth: 0
- name: Set env - name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
@ -45,10 +46,21 @@ jobs:
- name: Deploy image - name: Deploy image
run: make docker-push VERSION=$RELEASE_VERSION run: make docker-push VERSION=$RELEASE_VERSION
- uses: wangyoucao577/go-release-action@v1.20 - name: Build
run: make build VERSION=$RELEASE_VERSION
- name: Prepare release
run: |
git log $(git describe HEAD~ --tags --abbrev=0)..HEAD --pretty='format:%h - %s (%cr) <%an>' --no-merges > changelog.txt
tar zcvf whatismyip-$RELEASE_VERSION-${{matrix.goosarch}}.tar.gz whatismyip LICENSE README.md
sha256sum whatismyip-$RELEASE_VERSION-${{matrix.goosarch}}.tar.gz > whatismyip-$RELEASE_VERSION-${{matrix.goosarch}}.tar.gz.sha256
- name: Release
uses: softprops/action-gh-release@v0.1.14
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} body_path: changelog.txt
goos: ${{ matrix.goos }} files: |
goarch: ${{ matrix.goarch }} whatismyip-${{env.RELEASE_VERSION}}-${{matrix.goosarch}}.tar.gz
build_command: make build VERSION=$RELEASE_VERSION whatismyip-${{env.RELEASE_VERSION}}-${{matrix.goosarch}}.tar.gz.sha256
extra_files: LICENSE README.md env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

BIN
LICENSE

Binary file not shown.