Skip to content

Commit c92b2f9

Browse files
committed
Use Malcolms build action
1 parent 765a79d commit c92b2f9

File tree

1 file changed

+27
-75
lines changed

1 file changed

+27
-75
lines changed
Lines changed: 27 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,46 @@
1-
name: Build and publish
2-
3-
# This workflow uses actions that are not certified by GitHub.
4-
# They are provided by a third-party and are governed by
5-
# separate terms of service, privacy policy, and support
6-
# documentation.
1+
name: Build Docker Image
72

83
on:
9-
# schedule:
10-
# - cron: '21 16 * * *'
114
push:
12-
branches: ["main"]
13-
# Publish semver tags as releases.
14-
tags: ["v*.*.*"]
15-
pull_request:
16-
branches: ["main"]
17-
18-
env:
19-
# Use docker.io for Docker Hub if empty
20-
REGISTRY: ghcr.io
21-
# github.repository as <account>/<repo>
22-
IMAGE_NAME: ${{ github.repository }}
235

246
jobs:
25-
build:
7+
docker:
268
runs-on: ubuntu-latest
279
permissions:
28-
contents: read
2910
packages: write
30-
# This is used to complete the identity challenge
31-
# with sigstore/fulcio when running outside of PRs.
32-
id-token: write
33-
3411
steps:
35-
- name: Checkout repository
36-
uses: actions/checkout@v4
12+
- name: Checkout
13+
uses: actions/checkout@v5
3714

38-
# Install the cosign tool except on PR
39-
# sigstore/cosign-installer
40-
# - name: Install cosign
41-
# if: github.event_name != 'pull_request'
42-
# uses: sigstore/cosign-installer@d6a3abf1bdea83574e28d40543793018b6035605
43-
# with:
44-
# cosign-release: 'v1.7.1'
45-
46-
# Workaround: docker/build-push-action/issues/461
47-
- name: Setup Docker buildx
48-
uses: docker/setup-buildx-action@v3
49-
with:
50-
driver: docker
15+
- name: Variables
16+
id: vars
17+
run: |
18+
echo "sha_long=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
19+
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
5120
52-
# Login against a Docker registry except on PR
53-
# docker/login-action
54-
- name: Log into registry ${{ env.REGISTRY }}
55-
if: github.event_name != 'pull_request'
21+
- name: Login to Docker Hub
5622
uses: docker/login-action@v3
5723
with:
58-
registry: ${{ env.REGISTRY }}
24+
registry: https://ghcr.io
5925
username: ${{ github.actor }}
6026
password: ${{ secrets.GITHUB_TOKEN }}
6127

62-
# Extract metadata (tags, labels) for Docker
63-
# docker/metadata-action
64-
- name: Extract Docker metadata
65-
id: meta
66-
uses: docker/metadata-action@v5
67-
with:
68-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
28+
- name: Set up QEMU
29+
uses: docker/setup-qemu-action@v3
6930

70-
# Build and push Docker image with Buildx (don't push on PR)
71-
# docker/build-push-action
72-
- name: Build and push Docker image
73-
id: build-and-push
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Build and push
7435
uses: docker/build-push-action@v6
7536
with:
76-
context: .
77-
push: ${{ github.event_name != 'pull_request' }}
78-
tags: ${{ steps.meta.outputs.tags }}
79-
labels: ${{ steps.meta.outputs.labels }}
80-
# cache-from: type=gha
81-
# cache-to: type=gha,mode=max
82-
83-
# Sign the resulting Docker image digest except on PRs.
84-
# This will only write to the public Rekor transparency log when the Docker
85-
# repository is public to avoid leaking data. If you would like to publish
86-
# transparency data even for private images, pass --force to cosign below.
87-
# sigstore/cosign
88-
# - name: Sign the published Docker image
89-
# if: ${{ github.event_name != 'pull_request' }}
90-
# env:
91-
# COSIGN_EXPERIMENTAL: "true"
92-
# This step uses the identity token to provision an ephemeral certificate
93-
# against the sigstore community Fulcio instance.
94-
# run: cosign sign ${{ steps.meta.outputs.tags }}@${{ steps.build-and-push.outputs.digest }}
37+
push: true
38+
tags: |
39+
ghcr.io/scouterna/j26-auth:latest
40+
ghcr.io/scouterna/j26-auth:${{ steps.vars.outputs.sha_short }}
41+
labels: |
42+
org.opencontainers.image.created=${{ github.event.head_commit.timestamp }}
43+
org.opencontainers.image.revision=${{ steps.vars.outputs.sha_long }}
44+
org.opencontainers.image.source=https://github.com/${{ github.repository }}
45+
org.opencontainers.image.description=Jamboree26 Authentication Service
46+
org.opencontainers.image.licenses=MIT

0 commit comments

Comments
 (0)