Skip to content

Commit 6341f98

Browse files
authored
add projects refresh release workflow (#2407)
1 parent 2b6e195 commit 6341f98

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Projects Refresh Service Docker Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'projects-refresh/v*'
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
12+
env:
13+
REGISTRY: ghcr.io
14+
IMAGE_NAME: ${{ github.repository }}/projects-refresh-service
15+
16+
jobs:
17+
build-and-push:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Derive version
25+
id: meta
26+
run: |
27+
TAG="${GITHUB_REF_NAME}" # e.g. projects-refresh/v1.2.3
28+
VERSION="${TAG##*/}" # v1.2.3
29+
echo "version=$VERSION" >> $GITHUB_OUTPUT
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Log in to Container Registry
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ${{ env.REGISTRY }}
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Extract metadata
42+
id: docker-meta
43+
uses: docker/metadata-action@v5
44+
with:
45+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
46+
tags: |
47+
type=raw,value=${{ steps.meta.outputs.version }}
48+
type=ref,event=tag
49+
type=raw,value=latest
50+
51+
- name: Build and push Docker image
52+
uses: docker/build-push-action@v5
53+
with:
54+
context: .
55+
file: ./Dockerfile_bg_projects_refresh
56+
push: true
57+
platforms: linux/amd64,linux/arm64
58+
tags: ${{ steps.docker-meta.outputs.tags }}
59+
labels: ${{ steps.docker-meta.outputs.labels }}
60+
build-args: |
61+
COMMIT_SHA=${{ github.sha }}
62+
63+
create-release:
64+
needs: [build-and-push]
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v4
68+
with:
69+
fetch-depth: 0
70+
71+
- name: Derive version
72+
id: meta
73+
run: |
74+
TAG="${GITHUB_REF_NAME}" # e.g. projects-refresh/v1.2.3
75+
VERSION="${TAG##*/}" # v1.2.3
76+
echo "version=$VERSION" >> $GITHUB_OUTPUT
77+
78+
- name: Create GitHub Release
79+
uses: softprops/action-gh-release@v1
80+
with:
81+
tag_name: ${{ github.ref_name }}
82+
name: Projects Refresh Service ${{ steps.meta.outputs.version }}
83+
body: |
84+
## Projects Refresh Service ${{ steps.meta.outputs.version }}
85+
86+
Background service for refreshing project data and maintaining synchronization.
87+
88+
### Docker Image
89+
```bash
90+
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
91+
```
92+
93+
draft: false
94+
prerelease: false
95+
96+

0 commit comments

Comments
 (0)