chore(deps): bump github.com/docker/docker from 20.10.3+incompatible to 24.0.7+incompatible #60
Workflow file for this run
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: Test, Build, Release | |
on: | |
push: | |
branches: [ 'master', 'pre-release' ] | |
pull_request: | |
branches: [ 'master', 'dev', 'pre-release' ] | |
env: | |
GH_REGISTRY: ghcr.io | |
REPOSITORY_NAME: ${{ github.repository }} | |
jobs: | |
# Build job runs on every PR into dev and master and pushes to master | |
test: | |
name: Test | |
strategy: | |
matrix: | |
go-version: [ 1.16.x ] | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Test | |
run: go test ./... | |
# Build job runs on every PR into dev and master and pushes to master | |
# Depends on test job | |
build-docker: | |
runs-on: ubuntu-latest | |
name: Build | |
needs: [ test ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@master | |
- name: Build Docker Images | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
builder: ${{ steps.buildx.outputs.name }} | |
pull: true | |
push: false | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# Release job runs on every push to master | |
# Depends on build job | |
release-docker: | |
runs-on: ubuntu-latest | |
name: Release | |
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/pre-release' }} | |
needs: [ build-docker ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
# Create semver tag and changelog | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v5.6 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
release_branches: master | |
pre_release_branches: pre-release | |
# Build Docker Images | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@master | |
- name: Extract metadata for Docker | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: | | |
${{ env.GH_REGISTRY }}/${{ env.REPOSITORY_NAME }} | |
${{ env.REPOSITORY_NAME }} | |
tags: | | |
type=semver,pattern={{version}},value=${{ steps.tag_version.outputs.new_tag }} | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.GH_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push version ${{ steps.tag_version.outputs.new_tag }} | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
builder: ${{ steps.buildx.outputs.name }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# Create GitHub release once images have been pushed | |
- name: Create a GitHub release ${{ steps.tag_version.outputs.new_tag }} | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} | |
prerelease: contains( ${{ steps.tag_version.outputs.release_type }} , 'pre' ) | |
# Build Go Release | |
- run: git tag ${{ steps.tag_version.outputs.new_tag }} | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.16 | |
- name: Run GoReleaser ${{ steps.tag_version.outputs.new_tag }} | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
version: latest | |
args: release | |
workdir: ./cmd/infrared/. | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |