Skip to content

Commit d6c619a

Browse files
authored
Publish prerelease version on main & Stop pushing from MR (#142)
* Remove pushing docker image from PR actions * use variable DOCKER_IMAGE_LABELS * Finish publish prerelease version
1 parent 8403ff1 commit d6c619a

File tree

3 files changed

+69
-27
lines changed

3 files changed

+69
-27
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,9 @@ jobs:
4141
steps:
4242
- uses: actions/checkout@v3
4343

44-
- name: Login to Docker Hub
45-
uses: docker/login-action@v2
46-
with:
47-
username: ${{ secrets.DOCKER_USERNAME }}
48-
password: ${{ secrets.DOCKER_PASSWORD }}
49-
50-
- name: Docker meta
51-
id: meta
52-
uses: docker/metadata-action@v4
53-
with:
54-
images: ${{ vars.DOCKER_IMAGE_NAME }}
55-
tags: |
56-
type=ref,event=pr
57-
type=sha
58-
labels: |
59-
org.opencontainers.image.title=CodeCoach
60-
org.opencontainers.image.description=Automated code review tool
61-
org.opencontainers.image.licenses=MIT
62-
63-
- name: Build and push PR image
44+
- name: Build
6445
uses: docker/build-push-action@v4
6546
with:
6647
context: .
6748
file: Dockerfile
68-
push: true
69-
tags: ${{ steps.meta.outputs.tags }}
70-
labels: ${{ steps.meta.outputs.labels }}
49+
push: false

.github/workflows/prerelease.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Prerelease
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish-rc-npm:
10+
env:
11+
VERSION: 0.0.0-rc${{ github.run_number }}
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 18
21+
always-auth: true
22+
registry-url: https://registry.npmjs.org/
23+
24+
- name: Cache node_modules
25+
uses: actions/cache@v3
26+
with:
27+
path: node_modules
28+
key: yarn-${{ hashFiles('yarn.lock') }}
29+
restore-keys: yarn-
30+
31+
- name: Install dependencies
32+
run: yarn
33+
34+
- name: Publish version ${{ env.VERSION }}
35+
run: yarn publish --access public --new-version ${{ env.VERSION }} --tag rc --no-git-tag-version
36+
env:
37+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
38+
39+
publish-rc-docker:
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- uses: actions/checkout@v3
44+
45+
- name: Login to Docker Hub
46+
uses: docker/login-action@v2
47+
with:
48+
username: ${{ secrets.DOCKER_USERNAME }}
49+
password: ${{ secrets.DOCKER_PASSWORD }}
50+
51+
- name: Docker meta
52+
id: meta
53+
uses: docker/metadata-action@v4
54+
with:
55+
images: ${{ vars.DOCKER_IMAGE_NAME }}
56+
tags: rc${{ github.run_number }}
57+
labels: ${{ vars.DOCKER_IMAGE_LABELS }}
58+
59+
- name: Build and push prerelease image
60+
uses: docker/build-push-action@v4
61+
with:
62+
context: .
63+
file: Dockerfile
64+
push: true
65+
tags: ${{ steps.meta.outputs.tags }}
66+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/release.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ jobs:
8181
type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }}
8282
type=semver,pattern={{major}},value=${{ env.VERSION }}
8383
type=ref,event=pr
84-
labels: |
85-
org.opencontainers.image.title=CodeCoach
86-
org.opencontainers.image.description=Automated code review tool
87-
org.opencontainers.image.licenses=MIT
84+
labels: ${{ vars.DOCKER_IMAGE_LABELS }}
8885

8986
- name: Build and push
9087
uses: docker/build-push-action@v4

0 commit comments

Comments
 (0)