Skip to content

Commit caa1858

Browse files
authored
Merge pull request #67 from polywrap/dev
prep 0.1.0a2 | /workflows/release-pr
2 parents 9bc90c6 + 89a4857 commit caa1858

File tree

3 files changed

+52
-52
lines changed

3 files changed

+52
-52
lines changed

.github/workflows/cd.yaml

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,63 +5,61 @@ on:
55
types: [closed]
66

77
jobs:
8-
getPackages:
8+
GetVersion:
99
runs-on: ubuntu-latest
10+
timeout-minutes: 60
1011
outputs:
11-
matrix: ${{ env.matrix }}
12-
steps:
13-
- name: Checkout repository
14-
uses: actions/checkout@v3
15-
- id: set-matrix
16-
run: echo "matrix=$(./scripts/getPackages.sh)" >> $GITHUB_ENV
17-
Publish:
18-
name: Publish python packages to pypi
19-
needs:
20-
- getPackages
21-
strategy:
22-
matrix: ${{fromJSON(needs.getPackages.outputs.matrix)}}
12+
version: ${{ env.RELEASE_VERSION }}
2313
if: |
2414
github.event.pull_request.user.login == 'polywrap-build-bot' &&
2515
github.event.pull_request.merged == true
26-
runs-on: ubuntu-18.04
2716
steps:
28-
- name: Checkout
29-
uses: actions/checkout@v3
30-
with:
31-
ref: ${{ github.event.pull_request.base.ref }}
32-
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
- name: Halt release if CI failed
20+
run: exit 1
21+
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
3322
- name: Read VERSION into env.RELEASE_VERSION
3423
run: echo RELEASE_VERSION=$(cat VERSION) >> $GITHUB_ENV
35-
36-
- name: Is Pre-Release
24+
- name: Check if tag Exists
25+
id: tag_check
26+
shell: bash -ex {0}
3727
run: |
38-
STR="${RELEASE_VERSION}"
39-
SUB='pre.'
40-
if [[ "$STR" == *"$SUB"* ]]; then
41-
echo PRE_RELEASE=true >> $GITHUB_ENV
42-
else
43-
echo PRE_RELEASE=false >> $GITHUB_ENV
28+
GET_API_URL="https://api.github.com/repos/${{github.repository}}/git/ref/tags/${{env.RELEASE_VERSION}}"
29+
http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \
30+
-H "Authorization: token ${GITHUB_TOKEN}")
31+
if [ "$http_status_code" -ne "404" ] ; then
32+
exit 1
4433
fi
45-
- name: Set up Python 3.10
46-
uses: actions/setup-python@v4
47-
with:
48-
python-version: "3.10"
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4936

50-
- name: Install python packages
51-
run: poetry install
52-
working-directory: ./packages/${{ matrix.package }}
53-
54-
- name: Publish python package to pypi
55-
run: poetry publish --build --username __token__ --password ${{secrets.POLYWRAP_BUILD_BOT_PYPI_PAT}}
56-
working-directory: ./packages/${{ matrix.package }}
57-
58-
- uses: actions/github-script@0.8.0
37+
Github-release:
38+
name: Create Release
39+
runs-on: ubuntu-latest
40+
needs:
41+
- GetVersion
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v2
45+
- name: print version with needs
46+
run: echo ${{ needs.GetVersion.outputs.version }}
47+
- id: changelog
48+
name: "Generate release changelog"
49+
uses: heinrichreimer/github-changelog-generator-action@v2.3
50+
with:
51+
unreleasedOnly: true
52+
unreleasedLabel: ${{ needs.GetVersion.outputs.version }}
53+
token: ${{ secrets.GITHUB_TOKEN }}
54+
continue-on-error: true
55+
- name: Create Release
56+
id: create_release
57+
uses: actions/create-release@v1
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5960
with:
60-
github-token: ${{secrets.GITHUB_TOKEN}}
61-
script: |
62-
github.issues.createComment({
63-
issue_number: context.issue.number,
64-
owner: context.repo.owner,
65-
repo: context.repo.repo,
66-
body: '**[NPM Release Published](https://www.npmjs.com/search?q=polywrap) `${{env.RELEASE_VERSION}}`** 🎉'
67-
})
61+
tag_name: ${{ needs.GetVersion.outputs.version }}
62+
release_name: Release ${{ needs.GetVersion.outputs.version }}
63+
body: ${{ steps.changelog.outputs.changelog }}
64+
draft: true
65+
prerelease: false

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0a2
1+
0.1.0a3

scripts/patchVersion.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ function patchVersion() {
99
cd packages/$package
1010
poetry version $version
1111
if [ "${#deps[@]}" -ne "0" ]; then
12-
for dep in "${deps[@]}"; do
13-
poetry add $dep@$version
14-
done
12+
if [ "${deps[0]}" != "" ]; then
13+
for dep in "${deps[@]}"; do
14+
poetry add $dep@$version
15+
done
16+
fi
1517
fi
1618
poetry lock
1719
poetry install

0 commit comments

Comments
 (0)