Skip to content

Commit 49088ac

Browse files
authored
Update Docker Hub tags and push to develop branch
1 parent 1a9c2e7 commit 49088ac

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Portainer - GitOps Demo
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the Main branch
7+
on:
8+
# push:
9+
# branches: [ main ]
10+
release:
11+
types: [published]
12+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
13+
jobs:
14+
# This workflow contains a single job called "build"
15+
build:
16+
# The type of runner that the job will run on
17+
runs-on: ubuntu-latest
18+
19+
# Steps represent a sequence of tasks that will be executed as part of the job
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Set env
23+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
24+
-
25+
name: Checkout
26+
uses: actions/checkout@v2
27+
-
28+
name: Set up QEMU
29+
uses: docker/setup-qemu-action@v1
30+
-
31+
name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v1
33+
-
34+
name: Login to DockerHub
35+
uses: docker/login-action@v1
36+
with:
37+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
38+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
39+
-
40+
name: Build and push
41+
uses: docker/build-push-action@v2
42+
with:
43+
context: ./
44+
file: ./Dockerfile
45+
platforms: linux/amd64
46+
push: true
47+
tags: |
48+
${{ secrets.DOCKER_HUB_USERNAME }}/gitops-develop:${{ env.RELEASE_VERSION }}
49+
- name: Update Kubernetes manifest
50+
run: |
51+
sed -i "s|image:mauu/gitops-develop:.*|image:mauu/gitops-develop:${{ env.RELEASE_VERSION }}|g" conf/manifest.yml
52+
- name: Commit and push changes
53+
run: |
54+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
55+
git config --local user.name "github-actions[bot]"
56+
git add conf/manifest.yml
57+
git commit -m "Update image tag to ${{ env.RELEASE_VERSION }}" || echo "No changes to commit"
58+
git push origin HEAD:develop

0 commit comments

Comments
 (0)