Skip to content

Commit 72508ec

Browse files
committed
add gh action
1 parent eebe891 commit 72508ec

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
release:
7+
runs-on: ubuntu-latest
8+
if: github.ref_type == 'tag'
9+
outputs:
10+
release_id: ${{ steps.release.outputs.release_id }}
11+
steps:
12+
- name: Make release
13+
id: release
14+
uses: actions/github-script@v5
15+
with:
16+
script: |
17+
const tag_name = context.ref.replace("refs/tags/", "")
18+
const release = await github.rest.repos.createRelease({
19+
owner: context.repo.owner,
20+
repo: context.repo.repo,
21+
tag_name
22+
})
23+
24+
core.setOutput('release_id', release.data.id);
25+
docker-image:
26+
runs-on: ubuntu-latest
27+
needs: release
28+
env:
29+
REGISTRY: ghcr.io
30+
IMAGE_NAME: ${{ github.repository }}
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v2
34+
- name: Login to cr
35+
uses: docker/login-action@v1
36+
with:
37+
registry: ${{ env.REGISTRY }}
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
- name: Extract metadata for Docker
41+
id: meta
42+
uses: docker/metadata-action@v3
43+
with:
44+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
45+
- name: Build and push Docker image
46+
uses: docker/build-push-action@v2
47+
with:
48+
context: .
49+
push: true
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)