Skip to content

Commit dcf9341

Browse files
chore: be able to deploy from different branches (#148)
1 parent e182bda commit dcf9341

File tree

6 files changed

+45
-117
lines changed

6 files changed

+45
-117
lines changed

.github/actions/release/action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ inputs:
99
npm_token:
1010
description: NPM token
1111
required: true
12-
release_target:
13-
description: Release target (patch, minor)
14-
required: false
15-
default: version-publish
12+
configuration:
13+
description: Release type (patch, minor, major, previous)
14+
required: true
1615

1716
runs:
1817
using: composite
@@ -22,9 +21,10 @@ runs:
2221
NODE_AUTH_TOKEN: ${{ inputs.npm_token }}
2322
GITHUB_TOKEN: ${{ inputs.github_token }}
2423
shell: bash
25-
run: pnpx nx affected --base=last-release --target=${{ inputs.release_target }} --parallel=1
24+
run: pnpx nx affected --base=last-release --target=version-publish --configuration=${{ inputs.configuration }} --parallel=1 --baseBranch=${{ github.ref_name }} --push=true
2625

2726
- name: Tag last-release
27+
if: github.ref == 'refs/heads/main'
2828
shell: bash
2929
run: git tag -f last-release
3030

.github/workflows/release.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1-
name: Release Patch
1+
name: Release
22

33
on:
4-
- workflow_dispatch
4+
workflow_dispatch:
5+
inputs:
6+
type:
7+
required: true
8+
type: choice
9+
description: Release type
10+
options:
11+
- patch
12+
- minor
13+
- major
14+
- previous
15+
default: 'patch'
516

617
jobs:
18+
validate:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- run: |
22+
[[ "${{ inputs.type }}" ]] || { echo "inputs.type input is empty" ; exit 1; }
23+
shell: bash
24+
725
test:
826
runs-on: ubuntu-latest
927

@@ -25,13 +43,11 @@ jobs:
2543

2644
release:
2745
runs-on: ubuntu-latest
28-
29-
if: github.ref == 'refs/heads/main'
30-
3146
needs: [test]
32-
3347
steps:
3448
- uses: actions/checkout@v3
49+
with:
50+
fetch-depth: 0
3551
- name: Setup
3652
uses: ./.github/actions/setup
3753

@@ -40,3 +56,4 @@ jobs:
4056
with:
4157
github_token: ${{ secrets.GITHUB_TOKEN }}
4258
npm_token: ${{ secrets.NPM_TOKEN }}
59+
configuration: ${{ github.event.inputs.type }}

.github/workflows/release_major.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/release_minor.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

packages/create-qwik-nx/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"executor": "@jscutlery/semver:version",
7171
"options": {
7272
"noVerify": true,
73-
"push": true,
73+
"push": false,
7474
"releaseAs": "patch",
7575
"postTargets": [
7676
"create-qwik-nx:publish",

packages/qwik-nx/project.json

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,21 @@
7676
"executor": "@jscutlery/semver:version",
7777
"options": {
7878
"noVerify": true,
79-
"push": true,
79+
"push": false,
8080
"releaseAs": "patch",
8181
"postTargets": ["qwik-nx:publish", "qwik-nx:push-to-github"]
82-
}
83-
},
84-
"version-publish-minor": {
85-
"executor": "@jscutlery/semver:version",
86-
"options": {
87-
"noVerify": true,
88-
"push": true,
89-
"releaseAs": "minor",
90-
"postTargets": ["qwik-nx:publish", "qwik-nx:push-to-github"]
91-
}
92-
},
93-
"version-publish-major": {
94-
"executor": "@jscutlery/semver:version",
95-
"options": {
96-
"noVerify": true,
97-
"push": true,
98-
"releaseAs": "major",
99-
"postTargets": ["qwik-nx:publish", "qwik-nx:push-to-github"]
82+
},
83+
"configurations": {
84+
"patch": {},
85+
"minor": {
86+
"releaseAs": "minor"
87+
},
88+
"major": {
89+
"releaseAs": "major"
90+
},
91+
"previous": {
92+
"postTargets": ["qwik-nx:publish:previous", "qwik-nx:push-to-github"]
93+
}
10094
}
10195
},
10296
"publish": {
@@ -107,6 +101,9 @@
107101
"configurations": {
108102
"local": {
109103
"registry": "http://localhost:4873"
104+
},
105+
"previous": {
106+
"tag": "previous"
110107
}
111108
}
112109
},

0 commit comments

Comments
 (0)