Skip to content

Commit 625aa73

Browse files
authored
Github Action Update (#9)
* feat: unique action * feat: single tagging * feat: semantic release workflow BREAKING CHANGE: adding semantic release workflow and unify gh actions
1 parent 576d9c8 commit 625aa73

File tree

3 files changed

+29
-109
lines changed

3 files changed

+29
-109
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,40 @@
1-
name: quay-main
2-
1+
name: ci
32

43
on:
54
push:
6-
branches: [ main ]
5+
branches: [ 'main' ]
6+
pull_request:
7+
branches:
8+
- main
79

810
jobs:
911
build:
1012
runs-on: ubuntu-latest
1113
steps:
1214
- uses: actions/checkout@v2
1315

14-
- name: Prepare
16+
- uses: go-semantic-release/action@v1
17+
id: semrel
18+
with:
19+
github-token: ${{ secrets.GITHUB_TOKEN }}
20+
changelog-file: CHANGELOG.md
21+
22+
- name: Prepare Dockerhub
1523
id: prep
1624
run: |
17-
DOCKER_IMAGE=quay.io/infralovers/packer-builder
25+
HUB_IMAGE=infralovers/packer-builder
26+
QUAY_IMAGE=quay.io/infralovers/packer-builder
27+
1828
VERSION=latest
19-
if [[ $GITHUB_REF == refs/tags/* ]]; then
20-
VERSION=${GITHUB_REF#refs/tags/v}
29+
if [[ '${{ steps.semrel.outputs.version }}' != '' ]]; then
30+
VERSION=${{ steps.semrel.outputs.version }}
2131
fi
2232
if [ "${{ github.event_name }}" = "schedule" ]; then
2333
VERSION=nightly
2434
fi
25-
TAGS="${DOCKER_IMAGE}:${VERSION}"
35+
TAGS="${QUAY_IMAGE}:${VERSION},${HUB_IMAGE}:${VERSION}"
2636
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
27-
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
37+
TAGS="$TAGS,${QUAY_IMAGE}:latest,${HUB_IMAGE}:latest}"
2838
fi
2939
echo ::set-output name=tags::${TAGS}
3040
@@ -41,21 +51,26 @@ jobs:
4151
${{ runner.os }}-buildx-
4252
4353
- name: Login to DockerHub
44-
if: github.event_name != 'pull_request'
54+
if: github.event_name != 'pull_request' && steps.semrel.outputs.version != ''
55+
uses: docker/login-action@v1
56+
with:
57+
username: ${{ secrets.DOCKERHUB_USER }}
58+
password: ${{ secrets.DOCKERHUB_TOKEN }}
59+
60+
- name: Login to Quay
61+
if: github.event_name != 'pull_request' && steps.semrel.outputs.version != ''
4562
uses: docker/login-action@v1
4663
with:
4764
registry: quay.io
4865
username: ${{ secrets.QUAY_USER }}
4966
password: ${{ secrets.QUAY_TOKEN }}
5067

51-
5268
- name: Build and push
5369
id: docker_build
5470
uses: docker/build-push-action@v2
5571
with:
5672
builder: ${{ steps.buildx.outputs.name }}
5773
context: .
5874
file: ./Dockerfile
59-
push: ${{ github.event_name != 'pull_request' }}
60-
tags: ${{ steps.prep.outputs.tags }}
61-
75+
push: ${{ github.event_name != 'pull_request' && steps.semrel.outputs.version != '' }}
76+
tags: ${{ steps.prep.outputs.tags }}

.github/workflows/main-dockerhub.yml

-59
This file was deleted.

.github/workflows/pr.yml

-36
This file was deleted.

0 commit comments

Comments
 (0)