-
Notifications
You must be signed in to change notification settings - Fork 23
78 lines (67 loc) · 1.97 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
name: Publish
on:
release:
types:
- published
workflow_dispatch:
inputs:
TAG_NAME:
description: 'Tag name that the major tag will point to'
required: true
env:
DOCKER_IMAGE_NAME: gofrolist/molecule
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
permissions:
contents: write
jobs:
publish:
name: Publish Release
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/[email protected]
- name: Docker meta
id: meta
uses: docker/[email protected]
with:
images: ${{ env.DOCKER_IMAGE_NAME }}
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}
type=ref,event=branch
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to DockerHub
if: github.event_name == 'release'
uses: docker/[email protected]
with:
username: ${{ github.actor }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push Docker image
uses: docker/[email protected]
with:
context: .
file: Dockerfile
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Update the ${{ env.TAG_NAME }} tag
id: update-major-tag
uses: actions/[email protected]
with:
source-tag: ${{ env.TAG_NAME }}
# slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
# - name: Update major tag
# uses: Actions-R-Us/actions-tagger@latest
validate:
needs:
- publish
runs-on: ubuntu-22.04
steps:
- name: Test run Molecule from DockerHub latest image
uses: docker://gofrolist/molecule:latest
with:
molecule_options: --version