Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: 👷 align releases and remove tag in case of failure #665

Merged
merged 6 commits into from
Aug 8, 2023
142 changes: 92 additions & 50 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,6 @@ jobs:
- run: yarn build
env:
EMSCRIPTEN: ${{ env.EMSDK }}/upstream/emscripten
- if: ${{ matrix.node-version == '16.x' }}
uses: actions/upload-artifact@v3
with:
name: javascript-artifact
path: |
./bindings/javascript/CHANGELOG.md
./bindings/javascript/LICENSE
./bindings/javascript/package.json
./bindings/javascript/README.md
./bindings/javascript/dist/
- name: 🧪 test bindings node-${{ matrix.node-version }}
run: yarn test
- name: 🔐 check crypto with node-${{ matrix.node-version }}
Expand Down Expand Up @@ -325,6 +315,41 @@ jobs:
awk '/Published release/ { printf("version=v%s\n",$8) }' semantic-release.log >> $GITHUB_OUTPUT
fi

js-build-release:
name: 🐯 js build release
needs: [semantic-release]
if: ${{ needs.semantic-release.outputs.release == 'True' }}
runs-on: ubuntu-latest
env:
EM_VERSION: 3.1.26
defaults:
run:
working-directory: bindings/javascript
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16.x
- uses: mymindstorm/setup-emsdk@v12
with:
version: ${{ env.EM_VERSION }}
- run: sudo apt-get update; sudo apt-get install zsh meson ninja-build
- run: yarn
- run: yarn build
env:
EMSCRIPTEN: ${{ env.EMSDK }}/upstream/emscripten
- uses: actions/upload-artifact@v3
with:
name: javascript-artifact
path: |
./bindings/javascript/CHANGELOG.md
./bindings/javascript/LICENSE
./bindings/javascript/package.json
./bindings/javascript/README.md
./bindings/javascript/dist/

python-build-check:
name: 🐍 Python build & checks
needs: [semantic-release]
Expand Down Expand Up @@ -461,45 +486,6 @@ jobs:
with:
path: ./bindings/python3/dist/*.tar.gz

npm-release:
name: 📦 npm release
runs-on: ubuntu-latest
needs: [semantic-release]
if: ${{ needs.semantic-release.outputs.release == 'True' }}
steps:
- uses: actions/checkout@v3
with:
ref: master
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v3
with:
name: javascript-artifact
path: .
- run: |
version=$(git describe --tags --abbrev=0)
yarn version --new-version ${version:1} --no-git-tag-version
- run: npm publish . --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

pypi-release:
name: 📦 PyPI release
needs: [python-build-check, python-build-check-armv7, python-sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

build-release-on-ubuntu:
name: 🐧 Binary builds on Ubuntu
runs-on: ubuntu-latest
Expand Down Expand Up @@ -576,9 +562,47 @@ jobs:
src/zenroom.command
src/zencode-exec.command

npm-release:
name: 📦 npm release
runs-on: ubuntu-latest
needs: [js-build-release, python-build-check, python-build-check-armv7, python-sdist, build-release-on-osx, build-release-on-ubuntu]
steps:
- uses: actions/checkout@v3
with:
ref: master
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v3
with:
name: javascript-artifact
path: .
- run: |
version=$(git describe --tags --abbrev=0)
yarn version --new-version ${version:1} --no-git-tag-version
- run: npm publish . --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

pypi-release:
name: 📦 PyPI release
needs: [js-build-release, python-build-check, python-build-check-armv7, python-sdist, build-release-on-osx, build-release-on-ubuntu]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

draft-binary-release:
name: 📦 Pack release
needs: [semantic-release, build-release-on-ubuntu]
needs: [semantic-release, js-build-release, python-build-check, python-build-check-armv7, python-sdist, build-release-on-osx, build-release-on-ubuntu]
runs-on: ubuntu-latest
steps:
- name: download binary artifacts
Expand All @@ -600,3 +624,21 @@ jobs:
prerelease: false
fail_on_unmatched_files: true
generate_release_notes: true

remove-tag-on-fail:
name: 🧻 Remove tag on fail
needs: [semantic-release, js-build-release, python-build-check, python-build-check-armv7, python-sdist, build-release-on-osx, build-release-on-ubuntu]
runs-on: ubuntu-latest
if: ${{ (failure() || cancelled()) && needs.semantic-release.outputs.release == 'True' }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Remove tag
uses: dev-drprasad/[email protected]
with:
tag_name: ${{ needs.semantic-release.outputs.version }}
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_release: false
repo: dyne/zenroom
Loading