Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.

Commit c8e855c

Browse files
committed
add workflow to publish container
1 parent 10cc4d2 commit c8e855c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI/CD
2+
on:
3+
push:
4+
paths:
5+
- docker
6+
pull_request:
7+
paths:
8+
- docker
9+
workflow_dispatch:
10+
11+
12+
jobs:
13+
build:
14+
name: Build and publish container
15+
runs-on: ubuntu-latest
16+
env:
17+
IMAGE_NAME: cpp
18+
VERSION: 0.1.0
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v1
25+
26+
- name: Login to GitHub Container Registry
27+
uses: docker/login-action@v1
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.repository_owner }}
31+
password: ${{ secrets.PAT }}
32+
33+
- name: Build and push
34+
uses: docker/build-push-action@v2
35+
with:
36+
context: .
37+
push: ${{ github.ref == 'refs/heads/main' }}
38+
tags: |
39+
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
40+
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}

0 commit comments

Comments
 (0)