Skip to content

Correctly populate the buildurl #206

Correctly populate the buildurl

Correctly populate the buildurl #206

Workflow file for this run

name: Build
on: [ push, workflow_dispatch ]
jobs:
setup:
runs-on: ubuntu-latest
outputs:
build_url: ${{ steps.data.outputs.build_url }}
steps:
- id: data
name: Populates outputs
run: |
echo "build_url=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" >> "$GITHUB_OUTPUT"
build:
if: github.event_name != 'release'
needs: setup
permissions:
packages: write
contents: read
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Construct image tags and labels
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/berkeleylibrary/geodata
labels: |
edu.berkeley.lib.build-timestamp=${{ github.event.repository.updated_at }}
edu.berkeley.lib.build-url=${{ needs.setup.outputs.build_url }}
edu.berkeley.lib.git-ref-name=${{ github.ref_name }}
edu.berkeley.lib.git-repository-url=${{ github.repositoryUrl }}
edu.berkeley.lib.git-sha=${{ github.sha }}
tags: |
type=sha
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: false
build-args: |
BUILD_TIMESTAMP=${{ github.event.repository.updated_at }}
BUILD_URL=${{ needs.setup.outputs.build_url }}
GIT_REF_NAME=${{ github.ref_name }}
GIT_REPOSITORY_URL=${{ github.repositoryUrl }}
GIT_SHA=${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}