Skip to content

Migrate config renovate.json5 (#4) #37

Migrate config renovate.json5 (#4)

Migrate config renovate.json5 (#4) #37

name: lint-test-build-push
on:
push:
permissions:
contents: read
packages: write
jobs:
lint-test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
- uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0
- run: shellcheck *.sh
- name: golangci-lint
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8
with:
version: latest
- name: Install dependencies
run: go get .
- name: Test with the Go CLI
run: go test -v ./...
build-push:
needs: [lint-test]
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" # v4
- name: Extract branch or tag name as docker tag
shell: bash
run: |-
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
TAG=$(echo "${GITHUB_REF#refs/tags/}" | sed 's/[^a-zA-Z0-9._-]//g' | awk '{print substr($0, length($0)-120)}')
else
TAG=$(echo "${GITHUB_REF#refs/heads/}" | sed 's/[^a-zA-Z0-9._-]//g' | awk '{print substr($0, length($0)-120)}')
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT
id: extract_tag
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
- id: setup
name: Setup docker build
shell: bash
run: |-
# only cache main tag to GHCR
if [ "${{steps.extract_tag.outputs.tag}}" = "main" ]; then
echo "cache-to=type=registry,ref=ghcr.io/lehigh-university-libraries/isle-fcrepo-fs:cache,mode=max" >> $GITHUB_OUTPUT
else
echo "cache-to=" >> $GITHUB_OUTPUT
fi
- name: ghcr Login
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push GHCR
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6
with:
platforms: |
linux/amd64
linux/arm64
push: true
cache-from: type=registry,ref=ghcr.io/lehigh-university-libraries/isle-fcrepo-fs:cache
cache-to: ${{ steps.setup.outputs.cache-to }}
tags: |
ghcr.io/lehigh-university-libraries/isle-fcrepo-fs:${{steps.extract_tag.outputs.tag}}