Skip to content

Commit 93454e2

Browse files
committed
added github workflow to build and publish container image
1 parent 58a5a4d commit 93454e2

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/ghcr-publish.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build image and publish to ghcr.io
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
env:
15+
REGISTRY: ghcr.io/arga-genomes
16+
IMAGE_NAME: data-processor
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
22+
- name: Build container image
23+
id: build-image
24+
uses: redhat-actions/buildah-build@v2
25+
with:
26+
image: ${{ env.IMAGE_NAME }}
27+
tags: latest ${{ github.sha }}
28+
containerfiles: |
29+
./Containerfile
30+
31+
- name: Log in to the GitHub container registry
32+
uses: redhat-actions/podman-login@v1
33+
with:
34+
registry: ${{ env.REGISTRY }}
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Push to GitHub container registry
39+
id: push-to-ghcr
40+
uses: redhat-actions/push-to-registry@v2
41+
with:
42+
image: ${{ steps.build-image.outputs.image }}
43+
tags: ${{ steps.build-image.outputs.tags }}
44+
registry: ${{ env.REGISTRY }}
45+
46+
notify-arga-ops:
47+
needs: build
48+
runs-on: ubuntu-latest
49+
50+
env:
51+
registry: ghcr.io/arga-genomes
52+
image_name: data-processor
53+
image_tag: ${{ github.sha }}
54+
actor: ${{ github.triggering_actor }}
55+
repository: ${{ github.repository }}
56+
ref: ${{ github.ref }}
57+
sha: ${{ github.sha }}
58+
workflow: ${{ github.workflow }}
59+
workflow_ref: ${{ github.workflow_ref }}
60+
workflow_sha: ${{ github.workflow_sha }}
61+
run_id: ${{ github.run_id }}
62+
run_number: ${{ github.run_number }}
63+
run_attempt: ${{ github.run_attempt }}
64+
65+
steps:
66+
- name: Dump payload data
67+
run: echo '${{ toJson(env) }}'
68+
69+
- name: Notify arga-ops about the new version
70+
uses: peter-evans/repository-dispatch@v2
71+
with:
72+
token: ${{ secrets.ARGA_OPS_PERSONAL_TOKEN }}
73+
repository: arga-genomes/arga-ops
74+
event-type: published
75+
client-payload: '{"data" : ${{ toJson(env) }} }'

0 commit comments

Comments
 (0)