Skip to content

Semantic versioning (#140) #50

Semantic versioning (#140)

Semantic versioning (#140) #50

Workflow file for this run

on:
push:
paths-ignore:
- "docs/**"
- "**.md"
- "examples/**"
branches:
- "main"
- "rc"
jobs:
PRCheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
- run: |
# Download the binary
curl -sLO https://github.com/argoproj/argo-workflows/releases/download/v3.5.4/argo-linux-amd64.gz
# Unzip
gunzip argo-linux-amd64.gz
# Make binary executable
chmod +x argo-linux-amd64
# Move binary to path
mv ./argo-linux-amd64 /usr/local/bin/argo
# Test installation
argo version
- run: python -m pip install poetry
- run: |
# python -m poetry install
poetry run tox
Release:
runs-on: ubuntu-latest
needs: PRCheck
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.8
- run: python -m pip install poetry
- run: |
python -m poetry install --only release
- name: Figure version
continue-on-error: true
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
id: last_tag
run: |
CURRENT=$(python -m poetry run semantic-release --noop version --print-last-released)
echo "Current: $CURRENT"
VERSION=$(python -m poetry run semantic-release --noop version --print)
echo "new: $VERSION"
python -m poetry run semantic-release version --tag --push
if [ "$CURRENT" == "$VERSION" ]; then
echo "version=$VERSION" >> $GITHUB_OUTPUT
exit 1
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
exit 0
# - name: Apply new tag
# if: steps.last_tag.outcome == 'success'
# env:
# VERSION: ${{ steps.last_tag.outputs.version }}
# uses: actions/github-script@v6
# with:
# script: |
# const {VERSION} = process.env
# const tag = `refs/tags/${VERSION}`
# await github.rest.git.createRef({
# owner: context.repo.owner,
# repo: context.repo.repo,
# ref: tag,
# sha: context.sha
# })
- name: Publish to PyPI
if: steps.last_tag.outcome == 'success'
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
LAST_TAG: ${{ steps.last_tag.outputs.version }}
run: |
python scripts/update_version.py $LAST_TAG
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build
- name: "Create release"
if: steps.last_tag.outcome == 'success'
env:
RELEASE_TAG: ${{ steps.last_tag.outputs.version }}
uses: "actions/github-script@v6"
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
try {
const response = await github.rest.repos.createRelease({
draft: false,
generate_release_notes: true,
name: process.env.RELEASE_TAG,
owner: context.repo.owner,
prerelease: false,
repo: context.repo.repo,
tag_name: process.env.RELEASE_TAG,
});
core.exportVariable('RELEASE_ID', response.data.id);
core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url);
} catch (error) {
core.setFailed(error.message);
}