Skip to content

Commit e1ab311

Browse files
authored
Create release.yml
1 parent 9bd5ce3 commit e1ab311

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

.github/workflows/release.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Deploying
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Get version
18+
id: package-version
19+
uses: martinbeentjes/npm-get-version-action@main
20+
21+
- name: Create Release
22+
uses: actions/create-release@v1
23+
env:
24+
TOKEN: ${{ secrets.TOKEN }}
25+
with:
26+
tag_name: ${{ steps.package-version.outputs.current-version }}
27+
release_name: Backend v${{ steps.package-version.outputs.current-version }}
28+
draft: false
29+
prerelease: false
30+
31+
registry:
32+
name: Push to registry
33+
runs-on: ubuntu-latest
34+
permissions:
35+
contents: read
36+
packages: write
37+
id-token: write
38+
39+
env:
40+
REGISTRY: ghcr.io
41+
IMAGE_NAME: ${{ github.repository }}
42+
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v4
46+
47+
- name: Setup Docker buildx
48+
uses: docker/setup-buildx-action@v3
49+
50+
- name: Get version
51+
id: package-version
52+
uses: martinbeentjes/npm-get-version-action@main
53+
54+
- name: Log into registry ${{ env.REGISTRY }}
55+
uses: docker/login-action@v2
56+
with:
57+
registry: ${{ env.REGISTRY }}
58+
username: ${{ github.actor }}
59+
password: ${{ secrets.TOKEN }}
60+
61+
- name: Extract Docker metadata
62+
id: meta
63+
uses: docker/metadata-action@v4
64+
with:
65+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
66+
flavor: |
67+
latest=auto
68+
tags: |
69+
type=semver,pattern={{version}},value=v${{ steps.package-version.outputs.current-version }}
70+
71+
- name: Build and push Docker image
72+
id: build-and-push
73+
uses: docker/build-push-action@v5
74+
with:
75+
push: true
76+
platforms: linux/amd64,linux/arm64
77+
context: .
78+
labels: ${{ steps.meta.outputs.labels }}
79+
tags: ${{ steps.meta.outputs.tags }}
80+
cache-from: type=gha
81+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)