forked from dchesterton/snmp2mqtt
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (55 loc) · 1.89 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
name: Publish
on:
push:
branches:
- main
jobs:
docker-publish:
name: Publish to Docker Hub
if: |
!contains(github.event.head_commit.message, '[ci skip]')
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Automated version bump
uses: phips28/gh-action-bump-version@master
id: bump
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version
run: |
RE='[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\([0-9A-Za-z-]*\)'
MAJOR=`echo $version | sed -e "s#$RE#\1#"`
MINOR=`echo $version | sed -e "s#$RE#\2#"`
PATCH=`echo $version | sed -e "s#$RE#\3#"`
echo "::set-output name=version::$MAJOR.$MINOR.$PATCH"
echo "::set-output name=major::$MAJOR"
echo "::set-output name=minor::$MAJOR.$MINOR"
id: version
env:
version: ${{ steps.bump.outputs.newTag }}
# - name: Set up QEMU
# uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to DockerHub
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/[email protected]
with:
push: true
# I'm only going to build for amd64 because that's all I personally need
# ,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
platforms: linux/amd64
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}
labels: "version=${{ steps.version.outputs.version }}"