Merge pull request #1 from MrMarble/dependabot/go_modules/golang.org/… #13
Workflow file for this run
This file contains hidden or 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: Build | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
- 'v*.*.*' | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.24' | |
- name: Lint | |
run: go tool task lint | |
- name: Build | |
run: go build -v ./ | |
build: | |
runs-on: ubuntu-latest | |
needs: lint | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract version | |
run: | | |
echo "version=$(git describe --tags --dirty --always --abbrev=12)" >> "$GITHUB_ENV" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
- name: Log into registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Build | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
build-args: | | |
VERSION=${{ env.version }} | |
push: false | |
load: true | |
tags: rootfsimage | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Export | |
run: | | |
id=$(docker create rootfsimage true) | |
mkdir -p ./plugin/rootfs/ | |
docker export "$id" | tar -x -C ./plugin/rootfs/ | |
docker rm -vf "$id" | |
- name: Publish latest | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
docker plugin create "docker.io/${{ secrets.DOCKER_USERNAME }}/opsd" ${PWD}/plugin | |
docker plugin push "docker.io/${{ secrets.DOCKER_USERNAME }}/opsd" | |
- name: Publish tagged | |
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
docker plugin rm "docker.io/${{ secrets.DOCKER_USERNAME }}/opsd" || true | |
docker plugin create "docker.io/${{ secrets.DOCKER_USERNAME }}/opsd:${{ github.ref_name }}" ${PWD}/plugin | |
docker plugin push "docker.io/${{ secrets.DOCKER_USERNAME }}/opsd:${{ github.ref_name }}" |