Publish #1
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: Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
is-alpha: | |
type: boolean | |
required: false | |
default: true | |
description: Whether to publish an alpha version or not | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'skyra-project' | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: main | |
token: ${{ secrets.SKYRA_TOKEN }} | |
- name: Install dependencies | |
uses: sapphiredev/.github/actions/install-yarn-dependencies@main | |
with: | |
node-version: 20 | |
- name: Configure Git | |
run: | | |
git remote set-url origin "https://${GITHUB_TOKEN}:[email protected]/${GITHUB_REPOSITORY}.git" | |
git config --local user.email "${GITHUB_EMAIL}" | |
git config --local user.name "${GITHUB_USER}" | |
env: | |
GITHUB_USER: github-actions[bot] | |
GITHUB_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update generated readme files | |
run: yarn inject | |
- name: Build code | |
run: yarn build | |
- name: Bump Versions and make release | |
working-directory: packages/core | |
run: | | |
if [ "${{ github.event.inputs.is-alpha }}" == "true" ]; then | |
yarn bump --preid alpha --github-release-pre-release --dry-run | |
else | |
yarn bump --dry-run | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Store new version | |
id: store-new-version | |
working-directory: packages/core | |
run: | | |
new_version=$(node -e "console.log(require('./package.json').version)") | |
echo "new_version=${new_version}" >> "$GITHUB_OUTPUT" | |
- name: Set version of react package | |
working-directory: packages/react | |
run: yarn version --new-version ${{ steps.store-new-version.outputs.new_version }} --immediate | |
- name: Copy changelog over | |
working-directory: packages/react | |
run: cp ../core/CHANGELOG.md CHANGELOG.md | |
- name: Publish @skyra/discord-components-core | |
working-directory: packages/core | |
run: | | |
yarn config set npmAuthToken ${NODE_AUTH_TOKEN} | |
yarn config set npmPublishRegistry "https://registry.yarnpkg.com" | |
# yarn npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
- name: Publish @skyra/discord-components-react | |
working-directory: packages/react | |
run: | | |
yarn config set npmAuthToken ${NODE_AUTH_TOKEN} | |
yarn config set npmPublishRegistry "https://registry.yarnpkg.com" | |
# yarn npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |