Skip to content

Commit

Permalink
chore(ci): Post release announce to slack
Browse files Browse the repository at this point in the history
  • Loading branch information
thomass-dev committed Oct 14, 2024
1 parent 54ff5c9 commit 2a326a6
Showing 1 changed file with 81 additions and 72 deletions.
153 changes: 81 additions & 72 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,93 +1,102 @@
name: Release

on:
release:
types: [released, prereleased]
on: [push]
# release:
# types: [released, prereleased]

jobs:
tag-restriction:
name: Tag must match semantic versioning pattern
runs-on: ubuntu-latest
environment: release
steps:
- shell: bash
run: |
if ! [[ "${GITHUB_REF_NAME}" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-rc\.(1|[1-9][0-9]*))?$ ]]; then
exit -1
fi
# tag-restriction:
# name: Tag must match semantic versioning pattern
# runs-on: ubuntu-latest
# environment: release
# steps:
# - shell: bash
# run: |
# if ! [[ "${GITHUB_REF_NAME}" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-rc\.(1|[1-9][0-9]*))?$ ]]; then
# exit -1
# fi

build:
name: Build package distributions
runs-on: ubuntu-latest
environment: release
permissions:
contents: read
needs: tag-restriction
steps:
- uses: actions/checkout@v4
# build:
# name: Build package distributions
# runs-on: ubuntu-latest
# environment: release
# permissions:
# contents: read
# needs: tag-restriction
# steps:
# - uses: actions/checkout@v4

- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: 20
# - name: Set up Node 20
# uses: actions/setup-node@v4
# with:
# node-version: 20

- name: Build skore-ui and share library
shell: bash
run: make build-skore-ui
# - name: Build skore-ui and share library
# shell: bash
# run: make build-skore-ui

- name: Override VERSION.txt with tag
run: echo "${GITHUB_REF_NAME}" > skore/VERSION.txt
# - name: Override VERSION.txt with tag
# run: echo "${GITHUB_REF_NAME}" > skore/VERSION.txt

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
# - name: Set up Python 3.12
# uses: actions/setup-python@v5
# with:
# python-version: "3.12"

- name: Build package distributions
run: |
cd skore
# - name: Build package distributions
# run: |
# cd skore

python -m pip install build
python -m build
# python -m pip install build
# python -m build

- name: Checks whether distribution’s long description will render correctly on PyPI
continue-on-error: true
run: |
python -m pip install twine
python -m twine check skore/dist/*
# - name: Checks whether distribution’s long description will render correctly on PyPI
# continue-on-error: true
# run: |
# python -m pip install twine
# python -m twine check skore/dist/*

- name: Upload package distributions
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: skore/dist/
# - name: Upload package distributions
# uses: actions/upload-artifact@v4
# with:
# name: python-package-distributions
# path: skore/dist/

publish:
name: Publish package distributions to PyPI using trusted publisher
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
needs: build
# environment: release
# permissions:
# id-token: write
# needs: build
steps:
- name: Download package distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
# - name: Download package distributions
# uses: actions/download-artifact@v4
# with:
# name: python-package-distributions
# path: dist/

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verify-metadata: false
# - name: Publish package distributions to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# verify-metadata: false

clean:
name: Delete package distributions artifacts
runs-on: ubuntu-latest
environment: release
if: always()
needs: publish
steps:
- uses: geekyeggo/delete-artifact@v5
- name: Post to slack
id: slack
uses: slackapi/[email protected]
with:
name: python-package-distributions
channel-id: "product-releases"
slack-message: "${{ github.event.release.html_url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

# clean:
# name: Delete package distributions artifacts
# runs-on: ubuntu-latest
# environment: release
# if: always()
# needs: publish
# steps:
# - uses: geekyeggo/delete-artifact@v5
# with:
# name: python-package-distributions

0 comments on commit 2a326a6

Please sign in to comment.