f820a0d5dd
Integration tests / Run CLI tests (windows-latest) (push) Waiting to run
Integration tests / Run CLI tests (macos-latest) (push) Waiting to run
Integration tests / Run API tests (push) Failing after 7s
Release / Changelog (push) Failing after 6s
Release / Publish (push) Skipped
Tests / Run unit tests (push) Failing after 13s
Integration tests / Run CLI tests (ubuntu-latest) (push) Failing after 1m6s
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eden Zimbelman <[email protected]>
163 lines
5.6 KiB
YAML
163 lines
5.6 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
jobs:
|
|
changelog:
|
|
name: Changelog
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
hasChangesets: ${{ steps.changesets.outputs.has-changesets }}
|
|
releaseExists: ${{ steps.published.outputs.exists }}
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: true
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
cache: npm
|
|
cache-dependency-path: package-lock.json
|
|
node-version-file: .nvmrc
|
|
|
|
- name: Install dependencies
|
|
run: npm ci --verbose
|
|
|
|
- name: Update release PR
|
|
id: changesets
|
|
uses: changesets/action@8488615a623b1b9c987934bb89eae8af6a946ac1 # v2.1.1
|
|
with:
|
|
commit-message: "chore: release"
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
pr-draft: create
|
|
pr-title: "chore: release"
|
|
version-script: npm run version
|
|
|
|
- name: Check if publish is needed
|
|
id: published
|
|
if: steps.changesets.outputs.has-changesets == 'false'
|
|
run: |
|
|
VERSION=$(node -p "require('./package.json').version")
|
|
if gh release view "v${VERSION}" &>/dev/null; then
|
|
echo "exists=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "exists=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish:
|
|
name: Publish
|
|
needs: changelog
|
|
if: needs.changelog.outputs.hasChangesets == 'false' && needs.changelog.outputs.releaseExists == 'false'
|
|
runs-on: ubuntu-latest
|
|
environment: publish
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Gather credentials
|
|
id: credentials
|
|
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
with:
|
|
client-id: ${{ secrets.GH_APP_CLIENT_ID }}
|
|
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
|
|
owner: ${{ github.repository_owner }}
|
|
repositories: ${{ github.event.repository.name }}
|
|
permission-contents: write
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: true
|
|
token: ${{ steps.credentials.outputs.token }}
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
cache: npm
|
|
cache-dependency-path: package-lock.json
|
|
node-version-file: .nvmrc
|
|
|
|
- name: Install dependencies
|
|
run: npm ci --verbose
|
|
|
|
- name: Build a production release
|
|
run: npm run build
|
|
|
|
- name: Gather version
|
|
id: version
|
|
run: |
|
|
VERSION="v$(node -p 'require("./package.json").version')"
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
echo "major=$(echo "$VERSION" | cut -d. -f1)" >> "$GITHUB_OUTPUT"
|
|
echo "minor=$(echo "$VERSION" | cut -d. -f1-2)" >> "$GITHUB_OUTPUT"
|
|
echo "$VERSION"
|
|
|
|
- name: Check if release exists
|
|
id: check
|
|
run: |
|
|
if gh release view "$VERSION" &>/dev/null; then
|
|
echo "exists=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "exists=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
env:
|
|
VERSION: ${{ steps.version.outputs.version }}
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Create release artifacts
|
|
if: steps.check.outputs.exists == 'false'
|
|
id: release
|
|
run: |
|
|
awk '/^## /{if(n++)exit}n' CHANGELOG.md | tail -n +3 > RELEASE.md
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git checkout -b "release/$VERSION"
|
|
git rm -rf .
|
|
git checkout HEAD -- LICENSE
|
|
git checkout HEAD -- README.md
|
|
git checkout HEAD -- action.yml
|
|
git checkout HEAD -- cli/
|
|
git add --force dist/
|
|
git commit -m "chore: release"
|
|
git push origin "release/$VERSION"
|
|
SHA=$(git rev-parse HEAD)
|
|
git tag -f "$MAJOR" "$SHA"
|
|
git tag -f "$MINOR" "$SHA"
|
|
git push -f origin "$MAJOR" "$MINOR"
|
|
echo "sha=$SHA" >> "$GITHUB_OUTPUT"
|
|
env:
|
|
VERSION: ${{ steps.version.outputs.version }}
|
|
MAJOR: ${{ steps.version.outputs.major }}
|
|
MINOR: ${{ steps.version.outputs.minor }}
|
|
|
|
- name: Create GitHub release
|
|
if: steps.check.outputs.exists == 'false'
|
|
run: gh release create "$VERSION" --target "$SHA" --title "Slack GitHub Action $VERSION" --notes-file RELEASE.md
|
|
env:
|
|
VERSION: ${{ steps.version.outputs.version }}
|
|
SHA: ${{ steps.release.outputs.sha }}
|
|
GH_TOKEN: ${{ steps.credentials.outputs.token }}
|
|
|
|
- name: Notify Slack
|
|
if: steps.check.outputs.exists == 'false'
|
|
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
|
|
with:
|
|
webhook: ${{ secrets.SLACK_RELEASE_ANNOUNCEMENTS_WEBHOOK_URL }}
|
|
webhook-type: webhook-trigger
|
|
payload: |
|
|
action_url: "https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.version }}"
|
|
message: "Slack GitHub Action ${{ steps.version.outputs.version }}"
|
|
repository: "${{ github.repository }}"
|