Skip to content

Commit 2fa9136

Browse files
committed
feat: add github workflow
1 parent 9c8bd2d commit 2fa9136

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Diff for: .github/workflows/workflow.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Test, build and push to github packages
2+
on:
3+
pull_request:
4+
branches:
5+
- 'master'
6+
push:
7+
branches:
8+
- '*'
9+
tags:
10+
- '*.*.*'
11+
12+
jobs:
13+
build-images:
14+
if: ${{ github.event_name == 'push' }}
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Set ENV for branch master/main
19+
if: ${{ github.ref == 'refs/heads/master' }}
20+
run: echo "RELEASE_VERSION=latest" >> $GITHUB_ENV
21+
- name: Set ENV for tags
22+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
23+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
24+
- name: Set ENV for specific branch
25+
if: ${{ startsWith(github.ref, 'refs/heads/') && !endsWith(github.ref, '/master') }}
26+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}-${GITHUB_SHA}" >> $GITHUB_ENV
27+
- name: Login to GHCR
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.repository_owner }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
- name: Build Image Odoo Nginx
34+
uses: docker/build-push-action@v2
35+
with:
36+
context: ./9.0
37+
platforms: linux/amd64
38+
push: true
39+
tags: ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }}

0 commit comments

Comments
 (0)