Skip to content

2023 - 🌐🐦⚡️ Release #2

2023 - 🌐🐦⚡️ Release

2023 - 🌐🐦⚡️ Release #2

Workflow file for this run

#############################################################################
# BUILD, PUSH, AND DEPLOY
#############################################################################
name: 🌐🐦⚡️ Release
on:
pull_request:
branches:
- 2023
workflow_dispatch:
concurrency: ${{ github.workflow }}-refs/heads/2023
env:
GITHUB_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
# #############################################################################
# JOBS
# #############################################################################
jobs:
build-and-push:
runs-on: ubuntu-latest
###########################################################################
# STEPS
###########################################################################
steps:
#########################################################################
# SETUP
#########################################################################
- name: ⬇️🛑 Cancel Previous Runs
uses: styfle/[email protected]
- name: ⬇️🛎 Checkout
uses: actions/checkout@v4
- name: ⬇️🥡 Install pnpm
uses: pnpm/action-setup@v4
- name: ⬇️🟢 Setup node
uses: actions/setup-node@v4
with:
node-version: 22.12.0
cache: 'pnpm'
- name: 🐙😺 Check GitHub API Rate Limit
id: rate_limit
run: |
response=$(gh api rate_limit)
limit=$(echo $response | jq -r '.resources.core.limit')
remaining=$(echo $response | jq -r '.resources.core.remaining')
echo "GitHub API Rate Limit: $remaining/$limit"
if [ "$remaining" -lt 10 ]; then
exit 1
fi
env:
GH_TOKEN: ${{ env.GITHUB_TOKEN }}
- name: ⬇️📦 Install dependencies
run: |
export npm_config_build_from_source=false
pnpm install --no-frozen-lockfile --ignore-scripts
#########################################################################
# BUILD
#########################################################################
- name: 🏗 Build packages
run: pnpm build
#########################################################################
# TEST
#########################################################################
- name: ✅ Run [e2e & unit] tests
run: pnpm test
#########################################################################
# EXIT IF IS PULL REQUEST
#########################################################################
- name: 🚪 Exit here if is pull request
if: github.event_name == 'pull_request'
run: |
echo "Pull request detected, exiting..."
exit 0
env:
GITHUB_TOKEN: ${{env.GITHUB_TOKEN }}
#########################################################################
#########################################################################
# UPDATE VERSIONS
#########################################################################
#########################################################################
- name: 📣 Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
title: "chore(release): version packages 🦋"
version: pnpm . pkg version --silent
publish: pnpm . pkg publish --silent
commit: "chore(release): version packages 🦋 [skip ci]"
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}
NPM_TOKEN: ${{ env.NPM_TOKEN }}
- name: Get updated versions if exists
id: updated
run: |
core_version=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[] | select(.name == "@pigeonposse/web-2023") | .version')
core_version_major=${core_version%%.*}
echo Set changesets outputs
echo '${{ toJSON(steps.changesets.outputs) }}'
echo Set updated versions
echo "core_version=$core_version" >> $GITHUB_OUTPUT
echo "core_version_major=$core_version_major" >> $GITHUB_OUTPUT
- name: 📚🐙😺➡️ Call to workflow for deploy Documentation
if: steps.updated.outputs.core_version != ''
uses: benc-uk/workflow-dispatch@v1
with:
workflow: docker.yml
continue-on-error: true
###############################################################################