File tree 2 files changed +15
-21
lines changed
actions/get-release-version
2 files changed +15
-21
lines changed Original file line number Diff line number Diff line change 1
- const branchName = process . env . GITHUB_REF ;
2
- const regex = / r e l e a s e \/ ( [ \d . ] + ) / gm;
1
+ const fs = require ( "fs" ) ;
2
+ const path = require ( "path" ) ;
3
+ const regex = / v e r s i o n = " ( [ \d . ] + ) " / gm;
3
4
4
- const matches = regex . exec ( branchName ) ;
5
+ const file_path = path . join ( process . env . GITHUB_WORKSPACE , "pyproject.toml" ) ;
6
+ const file_contents = fs . readFileSync ( file_path , { encoding : "utf8" } ) ;
7
+ const matches = regex . exec ( file_contents ) ;
5
8
if ( matches && matches . length == 2 ) {
6
9
const [ _ , version ] = matches ;
7
- const fs = require ( "fs" ) ;
8
10
9
11
fs . appendFileSync ( process . env . GITHUB_OUTPUT , `version=${ version } ` , {
10
12
encoding : "utf8" ,
11
13
} ) ;
12
14
} else {
13
- throw new Error ( `No version found in release title: ${ input_title } ` ) ;
15
+ throw new Error ( `No version found in ${ file_path } ` ) ;
14
16
}
Original file line number Diff line number Diff line change 1
- # This workflow will only run on prs from the release/* branch that were merged
2
1
name : Release
3
- on :
4
- pull_request :
5
- types :
6
- - closed
7
- branches :
8
- - " release/**"
2
+ on : [workflow_dispatch]
9
3
10
4
permissions :
11
5
contents : write
12
6
13
7
jobs :
14
8
release :
15
- if : github.event.pull_request.merged == true
16
9
runs-on : ubuntu-latest
17
10
steps :
18
11
- uses : actions/checkout@v3
@@ -32,20 +25,19 @@ jobs:
32
25
run : |
33
26
git config --local user.email "github-actions[bot]@users.noreply.github.com"
34
27
git config --local user.name "github-actions[bot]"
35
- git switch main
36
- git pull
28
+ git fetch origin main
29
+ git checkout main
37
30
git tag ${{ steps.release_version.outputs.version }}
38
31
git push origin ${{ steps.release_version.outputs.version }}
39
32
- name : Create release
40
33
uses : softprops/action-gh-release@v1
41
34
with :
42
35
files : dist/*
43
36
tag_name : ${{ steps.release_version.outputs.version}}
44
- draft : true
45
37
generate_release_notes : true
46
38
name : ${{ steps.release_version.outputs.version}}
47
- # - name: Publish
48
- # run: poetry run twine upload dist/*
49
- # env:
50
- # TWINE_USERNAME: __token__
51
- # TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
39
+ - name : Publish
40
+ run : poetry run twine upload dist/*
41
+ env :
42
+ TWINE_USERNAME : __token__
43
+ TWINE_PASSWORD : ${{ secrets.PYPI_TOKEN }}
You can’t perform that action at this time.
0 commit comments