-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (76 loc) · 2.55 KB
/
create_release.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
79
80
name: Create Release
on:
# Only create a release if the Dockerfile has changed.
push:
branches: [main]
paths:
- 'renovate_image/Dockerfile'
workflow_dispatch:
inputs:
version_increment:
description: "Specifies how the release version will be incremented from the current version."
type: choice
required: true
default: minor
options:
- major
- minor
- patch
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
VERSION_INCREMENT: ${{ inputs.version_increment || 'patch' }}
jobs:
create_release:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
release_tag: ${{ steps.version.outputs.v-version }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Get next version
uses: reecetech/[email protected]
id: version
with:
scheme: semver
increment: ${{ env.VERSION_INCREMENT }}
- name: Create Release
uses: softprops/[email protected]
id: release
with:
name: Release ${{ steps.version.outputs.version }}
tag_name: ${{ steps.version.outputs.v-version }}
generate_release_notes: true
build_and_push_image:
needs: [create_release]
if: success()
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Log in to the Container registry
uses: docker/login-action@327cd5a69de6c009b9ce71bce8395f28e651bf99
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e1d5461f02b7886d3c1a774bfbd873650445aa2
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d
with:
context: ./renovate_image
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create_release.outputs.release_tag }}
labels: ${{ steps.meta.outputs.labels }}