-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,30 @@ on: | |
- 'main' | ||
- 'alpha' | ||
jobs: | ||
prepare: | ||
runs-on: unbuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.8.1 | ||
|
||
- name: Semantic Release dry-run | ||
id: dry-run | ||
uses: cycjimmy/semantic-release-action@v4 | ||
with: | ||
dry_run: true | ||
extra_plugins: | | ||
@semantic-release/commit-analyzer | ||
@semantic-release/exec | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release: | ||
needs: prepare | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -36,30 +59,15 @@ jobs: | |
# ====================== release ====================== | ||
|
||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.8.1 | ||
|
||
- name: Semantic Release dry-run | ||
uses: cycjimmy/semantic-release-action@v4 | ||
with: | ||
dry_run: true | ||
extra_plugins: | | ||
@semantic-release/commit-analyzer | ||
@semantic-release/exec | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set test pip url | ||
if: ${{ github.ref_name == 'alpha' }} | ||
run: | | ||
echo "PYPI_URL=https://test.pypi.org/project/labelu/${{ env.NEXT_VERSION }}" >> $GITHUB_ENV | ||
echo "PYPI_URL=https://test.pypi.org/project/labelu/${{ needs.prepare.outputs.NEXT_VERSION }}" >> $GITHUB_ENV | ||
- name: Set release pip url | ||
if: ${{ github.ref_name == 'main' }} | ||
run: | | ||
echo "PYPI_URL=https://pypi.org/project/labelu/${{ env.NEXT_VERSION }}" >> $GITHUB_ENV | ||
echo "PYPI_URL=https://pypi.org/project/labelu/${{ needs.prepare.outputs.NEXT_VERSION }}" >> $GITHUB_ENV | ||
- name: Show pypi url | ||
run: | | ||
|
@@ -68,6 +76,8 @@ jobs: | |
- name: Inject backend info into frontend | ||
uses: satackey/[email protected] | ||
id: InjectBackend | ||
env: | ||
NEXT_VERSION: ${{ needs.prepare.outputs.NEXT_VERSION }} | ||
with: | ||
required-packages: '@iarna/toml' | ||
script: | | ||
|
@@ -112,7 +122,6 @@ jobs: | |
poetry-version: ${{ matrix.poetry-version }} | ||
|
||
- name: Install dependencies | ||
if: ${{ env.NEXT_VERSION != '' }} | ||
run: poetry install --without dev | ||
|
||
- name: Run tests | ||
|
@@ -126,27 +135,25 @@ jobs: | |
verbose: true | ||
|
||
- name: Manage version | ||
if: ${{ env.NEXT_VERSION != '' }} | ||
run: | | ||
sed -i "s/^version[ ]*=.*/version = '${NEXT_VERSION}'/" pyproject.toml | ||
- name: Commit version change | ||
if: ${{ env.NEXT_VERSION != '' }} | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: 'chore: Upgrade to v${{ env.NEXT_VERSION }} [skip ci]' | ||
commit_message: 'chore: Upgrade to v${{ needs.prepare.outputs.NEXT_VERSION }} [skip ci]' | ||
file_pattern: pyproject.toml | ||
|
||
- name: Publish to TestPyPi | ||
if: ${{ github.ref_name == 'alpha' && env.NEXT_VERSION != ''}} | ||
if: ${{ github.ref_name == 'alpha'}} | ||
env: | ||
TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} | ||
run: | | ||
poetry config pypi-token.testpypi $TEST_PYPI_TOKEN | ||
poetry publish --build --skip-existing -r testpypi | ||
- name: Publish to PyPi | ||
if: ${{ github.ref_name == 'main' && env.NEXT_VERSION != ''}} | ||
if: ${{ github.ref_name == 'main'}} | ||
env: | ||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | ||
run: | | ||
|
@@ -167,11 +174,10 @@ jobs: | |
# ====================== post release ====================== | ||
|
||
- name: Send webhook message | ||
if: ${{ env.RELEASE_NOTES != '' }} | ||
uses: joelwmale/webhook-action@master | ||
env: | ||
CHANGELOG: ${{ github.event.inputs.changelog != '' && format('## Frontend changelog \n{0}\n\n\n', github.event.inputs.changelog) || '' }} | ||
with: | ||
url: ${{ secrets.WEBHOOK_URL }} | ||
headers: '{"Content-Type": "application/json"}' | ||
body: '{"msgtype":"markdown","markdown":{"content":"${{ env.RELEASE_NOTES }}${{ env.CHANGELOG }}Check it out now \ud83d\udc49\ud83c\udffb [v${{ env.NEXT_VERSION }}](${{ env.PYPI_URL }})"}}' | ||
body: '{"msgtype":"markdown","markdown":{"content":"${{ needs.prepare.outputs.RELEASE_NOTES }}${{ env.CHANGELOG }}Check it out now \ud83d\udc49\ud83c\udffb [v${{ needs.prepare.outputs.NEXT_VERSION }}](${{ env.PYPI_URL }})"}}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters