Releasing #49
Workflow file for this run
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
name: Build & Release | |
run-name: "Releasing" | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
jobs: | |
publish-python-sdk: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Github Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: "3.x" | |
- name: Install hatch | |
run: | | |
pip install hatch | |
- name: Build SDK | |
run: | | |
hatch build | |
- name: Publish Python 🐍 distributions 📦 to PyPI | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.PYPI_TOKEN }} | |
publish-node-sdk: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org | |
cache: npm | |
cache-dependency-path: src/typescript/package-lock.json | |
- name: Install Node.js dependencies | |
working-directory: src/typescript | |
run: npm ci | |
- name: Configure npm for publish | |
working-directory: src/typescript | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | |
- name: Release package | |
working-directory: src/typescript | |
run: npm run build && npm run publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
post-release: | |
name: Post Release Actions | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
needs: | |
- publish-python-sdk | |
- publish-node-sdk | |
steps: | |
- name: Checkout main branch | |
uses: actions/[email protected] | |
with: | |
ref: main | |
- name: Slack - Success Message | |
uses: DSdatsme/slack-github-action@env_support | |
if: ${{ success() && needs.publish-python-sdk.result == 'success' && needs.publish-node-sdk.result == 'success' }} | |
with: | |
channel-id: ${{ vars.SLACK_CHANNEL_ID }} | |
payload-file-path: ./.github/resources/slack-payloads/slack-message-template.json | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
PRE_TEXT_MESSAGE: "Workflow Passed! :successkid:" | |
FALLBACK_MESSAGE: "Workflow Passed!" | |
COLOR: "good" | |
- name: Slack - Failure Message | |
uses: DSdatsme/slack-github-action@env_support | |
if: ${{ failure() || needs.publish-python-sdk.result != 'success' || needs.publish-node-sdk.result != 'success' }} | |
with: | |
channel-id: ${{ vars.SLACK_CHANNEL_ID }} | |
payload-file-path: ./.github/resources/slack-payloads/slack-message-template.json | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
PRE_TEXT_MESSAGE: "<!channel> Workflow Failed! :x:" | |
FALLBACK_MESSAGE: "Workflow Failed!" | |
COLOR: "danger" |