Skip to content

Build Docker Image

Build Docker Image #37

Workflow file for this run

name: Build Docker Image
on:
push:
tags:
- 'v*'
workflow_run:
workflows: ["Tests"]
branches: [master]
types:
- completed
jobs:
version:
name: Release GitHub tag
runs-on: 'ubuntu-latest'
if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: write
outputs:
new_tag: ${{ steps.tag_version.outputs.new_tag }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
default_bump: minor
github_token: ${{ secrets.GITHUB_TOKEN }}
push:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
needs: [ release ]

Check failure on line 36 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / Build Docker Image

Invalid workflow file

The workflow is not valid. .github/workflows/build.yml (Line: 36, Col: 14): Job 'push' depends on unknown job 'release'.
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Login to GitHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_REGISTRY_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push to GitHub
uses: docker/build-push-action@v5
with:
context: ./
file: ./Dockerfile
push: true
tags: ghcr.io/omegion/ssh-manager:latest,ghcr.io/omegion/ssh-manager:${{ needs.version.outputs.new_tag }}
platforms: linux/amd64,linux/arm64
build-args: VERSION=${{ needs.version.outputs.new_tag }}
build:
name: Create Release
runs-on: 'ubuntu-latest'
strategy:
matrix:
# List of GOOS and GOARCH pairs from `go tool dist list`
goosarch:
- 'darwin/amd64'
- 'darwin/arm64'
- 'linux/amd64'
- 'linux/arm64'
- 'windows/amd64'
- 'windows/arm64'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Get OS and arch info
run: |
GOOSARCH=${{matrix.goosarch}}
GOOS=${GOOSARCH%/*}
GOARCH=${GOOSARCH#*/}
BINARY_NAME=ssh-manager-$GOOS-$GOARCH
echo "BINARY_NAME=$BINARY_NAME" >> $GITHUB_ENV
echo "GOOS=$GOOS" >> $GITHUB_ENV
echo "GOARCH=$GOARCH" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build
run: |
make build TARGETOS="$GOOS" TARGETARCH="$GOARCH" VERSION="${{ needs.version.outputs.new_tag }}" BINARY_NAME="$BINARY_NAME"
- name: Release with Notes
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.version.outputs.new_tag }}
name: Release ${{ needs.version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
draft: false
files: ${{env.BINARY_NAME}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}