Release #23
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 | |
on: workflow_dispatch | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
issues: write | |
env: | |
CI: "true" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
with: | |
fetch-depth: 0 | |
- name: Set git config safe.directory | |
run: git config --global --add safe.directory "$(pwd)" | |
- name: Set git identity | |
run: |- | |
git config user.name "github-actions" | |
git config user.email "github-actions@github.com" | |
- name: Setup Node.js | |
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 | |
with: | |
node-version: 18.x | |
- name: Install dependencies | |
run: yarn install --check-files --frozen-lockfile | |
- name: release | |
run: npx projen release | |
- name: Backup artifact permissions | |
run: cd dist && rm -rf submodules/ && getfacl -R . > permissions-backup.acl | |
continue-on-error: true | |
- name: Upload artifact | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 | |
with: | |
name: build-artifact | |
path: dist | |
release_npm: | |
name: Publish to npm | |
needs: release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
issues: write | |
steps: | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 | |
with: | |
node-version: 18.x | |
- name: Download build artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a | |
with: | |
name: build-artifact | |
path: dist | |
- name: Restore build artifact permissions | |
run: cd dist && setfacl --restore=permissions-backup.acl | |
continue-on-error: true | |
- name: Prepare Repository | |
run: mv dist .repo | |
- name: Install Dependencies | |
run: cd .repo && yarn install --check-files --frozen-lockfile | |
- name: Create js artifact | |
run: cd .repo && npx projen package:js | |
- name: Collect js Artifact | |
run: mv .repo/dist dist | |
- name: Release | |
env: | |
NPM_DIST_TAG: latest | |
NPM_REGISTRY: registry.npmjs.org | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npx -p publib@latest publib-npm | |
- name: Extract Version | |
id: extract-version | |
if: ${{ failure() }} | |
run: echo "VERSION=$(cat dist/version.txt)" >> "${GITHUB_OUTPUT}" | |
- name: Create Issue | |
if: ${{ failure() }} | |
uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd | |
with: | |
labels: failed-release | |
title: Publishing v${{ steps.extract-version.outputs.VERSION }} to npm failed | |
body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
release_maven: | |
name: Publish to Maven Central | |
needs: release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
issues: write | |
steps: | |
- uses: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 | |
with: | |
distribution: temurin | |
java-version: 11.x | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 | |
with: | |
node-version: 18.x | |
- name: Download build artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a | |
with: | |
name: build-artifact | |
path: dist | |
- name: Restore build artifact permissions | |
run: cd dist && setfacl --restore=permissions-backup.acl | |
continue-on-error: true | |
- name: Prepare Repository | |
run: mv dist .repo | |
- name: Install Dependencies | |
run: cd .repo && yarn install --check-files --frozen-lockfile | |
- name: Create java artifact | |
run: cd .repo && npx projen package:java | |
- name: Collect java Artifact | |
run: mv .repo/dist dist | |
- name: Release | |
env: | |
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
MAVEN_GPG_PRIVATE_KEY_PASSPHRASE: ${{ secrets.MAVEN_GPG_PRIVATE_KEY_PASSPHRASE }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_STAGING_PROFILE_ID: ${{ secrets.MAVEN_STAGING_PROFILE_ID }} | |
run: npx -p publib@latest publib-maven | |
- name: Extract Version | |
id: extract-version | |
if: ${{ failure() }} | |
run: echo "VERSION=$(cat dist/version.txt)" >> "${GITHUB_OUTPUT}" | |
- name: Create Issue | |
if: ${{ failure() }} | |
uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd | |
with: | |
labels: failed-release | |
title: Publishing v${{ steps.extract-version.outputs.VERSION }} to Maven Central failed | |
body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
release_pypi: | |
name: Publish to PyPI | |
needs: release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
issues: write | |
steps: | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 | |
with: | |
node-version: 18.x | |
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c | |
with: | |
python-version: 3.x | |
- name: Download build artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a | |
with: | |
name: build-artifact | |
path: dist | |
- name: Restore build artifact permissions | |
run: cd dist && setfacl --restore=permissions-backup.acl | |
continue-on-error: true | |
- name: Prepare Repository | |
run: mv dist .repo | |
- name: Install Dependencies | |
run: cd .repo && yarn install --check-files --frozen-lockfile | |
- name: Create python artifact | |
run: cd .repo && npx projen package:python | |
- name: Collect python Artifact | |
run: mv .repo/dist dist | |
- name: Release | |
env: | |
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | |
run: npx -p publib@latest publib-pypi | |
- name: Extract Version | |
id: extract-version | |
if: ${{ failure() }} | |
run: echo "VERSION=$(cat dist/version.txt)" >> "${GITHUB_OUTPUT}" | |
- name: Create Issue | |
if: ${{ failure() }} | |
uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd | |
with: | |
labels: failed-release | |
title: Publishing v${{ steps.extract-version.outputs.VERSION }} to PyPI failed | |
body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
release_nuget: | |
name: Publish to NuGet Gallery | |
needs: release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
issues: write | |
steps: | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 | |
with: | |
node-version: 18.x | |
- uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 | |
with: | |
dotnet-version: 3.x | |
- name: Download build artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a | |
with: | |
name: build-artifact | |
path: dist | |
- name: Restore build artifact permissions | |
run: cd dist && setfacl --restore=permissions-backup.acl | |
continue-on-error: true | |
- name: Prepare Repository | |
run: mv dist .repo | |
- name: Install Dependencies | |
run: cd .repo && yarn install --check-files --frozen-lockfile | |
- name: Create dotnet artifact | |
run: cd .repo && npx projen package:dotnet | |
- name: Collect dotnet Artifact | |
run: mv .repo/dist dist | |
- name: Release | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
run: npx -p publib@latest publib-nuget | |
- name: Extract Version | |
id: extract-version | |
if: ${{ failure() }} | |
run: echo "VERSION=$(cat dist/version.txt)" >> "${GITHUB_OUTPUT}" | |
- name: Create Issue | |
if: ${{ failure() }} | |
uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd | |
with: | |
labels: failed-release | |
title: Publishing v${{ steps.extract-version.outputs.VERSION }} to NuGet Gallery failed | |
body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
release_golang: | |
name: Publish to GitHub Go Module Repository | |
needs: release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
issues: write | |
steps: | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 | |
with: | |
node-version: 18.x | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 | |
with: | |
go-version: ^1.16.0 | |
- name: Download build artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a | |
with: | |
name: build-artifact | |
path: dist | |
- name: Restore build artifact permissions | |
run: cd dist && setfacl --restore=permissions-backup.acl | |
continue-on-error: true | |
- name: Prepare Repository | |
run: mv dist .repo | |
- name: Install Dependencies | |
run: cd .repo && yarn install --check-files --frozen-lockfile | |
- name: Create go artifact | |
run: cd .repo && npx projen package:go | |
- name: Collect go Artifact | |
run: mv .repo/dist dist | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GO_GITHUB_TOKEN }} | |
GIT_USER_NAME: ${{ secrets.GO_GIT_USER_NAME }} | |
GIT_USER_EMAIL: ${{ secrets.GO_GIT_USER_EMAIL }} | |
run: npx -p publib@latest publib-golang | |
- name: Extract Version | |
id: extract-version | |
if: ${{ failure() }} | |
run: echo "VERSION=$(cat dist/version.txt)" >> "${GITHUB_OUTPUT}" | |
- name: Create Issue | |
if: ${{ failure() }} | |
uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd | |
with: | |
labels: failed-release | |
title: Publishing v${{ steps.extract-version.outputs.VERSION }} to GitHub Go Module Repository failed | |
body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
release_github: | |
name: Publish to GitHub Releases | |
needs: [release, release_npm, release_maven, release_pypi, release_nuget, release_golang] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
issues: write | |
steps: | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 | |
with: | |
node-version: 18.x | |
- name: Download build artifacts | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a | |
with: | |
name: build-artifact | |
path: dist | |
- name: Restore build artifact permissions | |
run: cd dist && setfacl --restore=permissions-backup.acl | |
continue-on-error: true | |
- name: Prepare Repository | |
run: mv dist .repo | |
- name: Collect GitHub Metadata | |
run: mv .repo/dist dist | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
GITHUB_REF: ${{ github.ref }} | |
run: errout=$(mktemp); gh release create "$(cat dist/releasetag.txt)" -R "${GITHUB_REPOSITORY}" -F dist/changelog.md -t "$(cat dist/releasetag.txt)" --target "${GITHUB_REF}" 2> "$errout" && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" "$errout"; then cat "$errout"; exit $exitcode; fi | |
- name: Extract Version | |
id: extract-version | |
if: ${{ failure() }} | |
run: echo "VERSION=$(cat dist/version.txt)" >> "${GITHUB_OUTPUT}" | |
- name: Create Issue | |
if: ${{ failure() }} | |
uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
labels: failed-release | |
title: Publishing v${{ steps.extract-version.outputs.VERSION }} to GitHub Releases failed | |
body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |