Skip to content

Bump golang version to 1.21 #150

Bump golang version to 1.21

Bump golang version to 1.21 #150

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- '*'
pull_request:
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
make: ["lint", "test"]
steps:
- uses: actions/checkout@v3
- name: install go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: ${{ matrix.make }}
run: make ${{ matrix.make }}
deploy:
runs-on: ubuntu-latest
needs: tests
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
strategy:
matrix:
goosarch: [linux-amd64]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: install go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
cache: true
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Sign in to dockerhub
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Deploy image
run: make docker-push VERSION=$RELEASE_VERSION
- 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 <%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@v1
with:
body_path: changelog.txt
files: |
whatismyip-${{env.RELEASE_VERSION}}-${{matrix.goosarch}}.tar.gz
whatismyip-${{env.RELEASE_VERSION}}-${{matrix.goosarch}}.tar.gz.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}