Skip to content

Commit 9507525

Browse files
committed
Attempting to update actions for both image outlets.
1 parent fec8835 commit 9507525

2 files changed

Lines changed: 68 additions & 1 deletion

File tree

.github/workflows/docker-publish.yml renamed to .github/workflows/docker-image-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717

1818
env:
1919
# Use docker.io for Docker Hub if empty
20-
REGISTRY: ghcr.io
20+
REGISTRY: docker.io
2121
# github.repository as <account>/<repo>
2222
IMAGE_NAME: ${{ github.repository }}
2323

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Create and publish container image/package
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.
7+
8+
on:
9+
# schedule:
10+
# - cron: '37 10 * * *'
11+
push:
12+
branches: [ master ]
13+
# Publish semver tags as releases.
14+
# tags: [ 'latest' ]
15+
pull_request:
16+
branches: [ master ]
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 }}
23+
24+
25+
jobs:
26+
build:
27+
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: read
31+
packages: write
32+
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v2
36+
37+
# Login against a package registry except on PR
38+
# https://github.com/docker/login-action
39+
- name: Log into registry ${{ env.REGISTRY }}
40+
if: github.event_name != 'pull_request'
41+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
42+
with:
43+
registry: ${{ env.REGISTRY }}
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
47+
# Extract metadata (tags, labels) for package
48+
# https://github.com/docker/metadata-action
49+
- name: Extract container metadata
50+
id: meta
51+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
52+
with:
53+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
54+
tags: |
55+
type=raw,value=latest,enable=${{ endsWith(GitHub.ref, 'master') }}
56+
flavor: |
57+
latest=true
58+
59+
# Build and push container image with Buildx (don't push on PR)
60+
# https://github.com/docker/build-push-action
61+
- name: Build and push container image
62+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
63+
with:
64+
context: .
65+
push: ${{ github.event_name != 'pull_request' }}
66+
tags: ${{ steps.meta.outputs.tags }}
67+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)