chore: improve release flow #301
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: 🌱 Release Edge | |
on: | |
push: | |
branches: | |
- 'master' | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: npm ci | |
- name: Get releases | |
id: fetch-latest-release | |
uses: ./.github/actions/fetch-latest-release | |
- name: Calculate edge version | |
id: calculate-edge-version | |
uses: ./.github/actions/calculate-edge-version | |
with: | |
version: ${{ steps.fetch-latest-release.outputs.tag_name }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Configure Git | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
- name: Bump version | |
run: npm version ${{ steps.calculate-edge-version.outputs.next-edge }} | |
- name: Commit and push version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git push origin master | |
- run: npm run build-all | |
- run: npm publish --tag edge | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Set Notification Messages | |
id: set-messages | |
run: | | |
if [[ ${{ job.status }} == "success" ]]; then | |
echo "SLACK_TITLE=Video Player ${{ steps.calculate-edge-version.outputs.next-edge }} Deployed" >> $GITHUB_OUTPUT | |
echo "SLACK_MESSAGE=Success :rocket: cloudinary-video-player version ${{ steps.calculate-edge-version.outputs.next-edge }} deployed successfully" >> $GITHUB_OUTPUT | |
echo "SLACK_FOOTER=Check it out at https://cloudinary.github.io/cloudinary-video-player/?ver=edge&min=true" >> $GITHUB_OUTPUT | |
else | |
echo "SLACK_TITLE=Video Player Deployment Failed" >> $GITHUB_OUTPUT | |
echo "SLACK_MESSAGE=:alert: Failed to deploy cloudinary-video-player version ${{ steps.calculate-edge-version.outputs.next-edge }}" >> $GITHUB_OUTPUT | |
echo "SLACK_FOOTER=See log here https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ github.job }}" >> $GITHUB_OUTPUT | |
fi | |
shell: bash | |
- name: Slack Notification | |
uses: rtCamp/action-slack-notify@v2.2.0 | |
env: | |
SLACK_WEBHOOK: ${{ vars.FE_DEPLOYMENTS_SLACK_WEBHOOK }} | |
SLACK_CHANNEL: 'rnd-fe-releases' | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_TITLE: ${{ steps.set-messages.outputs.SLACK_TITLE }} | |
SLACK_MESSAGE: ${{ steps.set-messages.outputs.SLACK_MESSAGE }} | |
SLACK_FOOTER: ${{ steps.set-messages.outputs.SLACK_FOOTER }} | |
- uses: gacts/purge-jsdelivr-cache@v1 | |
with: | |
url: | | |
https://cdn.jsdelivr.net/npm/cloudinary-video-player@edge |