Skip to content

fix: contributors guide (#67) #51

fix: contributors guide (#67)

fix: contributors guide (#67) #51

Workflow file for this run

# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".
name: release
on:
push:
branches:
- main
workflow_dispatch: {}
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
latest_commit: ${{ steps.git_remote.outputs.latest_commit }}
publish-cdklabs-cdk-cicd-wrapper: ${{ steps.check-publish-cdklabs-cdk-cicd-wrapper.outputs.publish }}
publish-cdklabs-cdk-cicd-wrapper-cli: ${{ steps.check-publish-cdklabs-cdk-cicd-wrapper-cli.outputs.publish }}
publish-cdklabs-cdk-cicd-wrapper-projen: ${{ steps.check-publish-cdklabs-cdk-cicd-wrapper-projen.outputs.publish }}
env:
CI: "true"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set git identity
run: |-
git config user.name "github-actions"
git config user.email "[email protected]"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
- name: release
run: npx projen release
- id: check-publish-cdklabs-cdk-cicd-wrapper
run: (git ls-remote -q --exit-code --tags origin $(cat dist/releasetag.txt) && (echo "publish=false" >> $GITHUB_OUTPUT)) || echo "publish=true" >> $GITHUB_OUTPUT
working-directory: packages/@cdklabs/cdk-cicd-wrapper
- id: check-publish-cdklabs-cdk-cicd-wrapper-cli
run: (git ls-remote -q --exit-code --tags origin $(cat dist/releasetag.txt) && (echo "publish=false" >> $GITHUB_OUTPUT)) || echo "publish=true" >> $GITHUB_OUTPUT
working-directory: packages/@cdklabs/cdk-cicd-wrapper-cli
- id: check-publish-cdklabs-cdk-cicd-wrapper-projen
run: (git ls-remote -q --exit-code --tags origin $(cat dist/releasetag.txt) && (echo "publish=false" >> $GITHUB_OUTPUT)) || echo "publish=true" >> $GITHUB_OUTPUT
working-directory: packages/@cdklabs/cdk-cicd-wrapper-projen
- name: Check for new commits
id: git_remote
run: echo "latest_commit=$(git ls-remote origin -h ${{ github.ref }} | cut -f1)" >> $GITHUB_OUTPUT
- name: "@cdklabs/cdk-cicd-wrapper: Backup artifact permissions"
if: ${{ steps.git_remote.outputs.latest_commit == github.sha }}
run: cd dist && getfacl -R . > permissions-backup.acl
continue-on-error: true
working-directory: packages/@cdklabs/cdk-cicd-wrapper
- name: "@cdklabs/cdk-cicd-wrapper: Upload artifact"
if: ${{ steps.git_remote.outputs.latest_commit == github.sha }}
uses: actions/upload-artifact@v4
with:
name: cdklabs-cdk-cicd-wrapper_build-artifact
path: packages/@cdklabs/cdk-cicd-wrapper/dist
overwrite: true
- name: "@cdklabs/cdk-cicd-wrapper-cli: Backup artifact permissions"
if: ${{ steps.git_remote.outputs.latest_commit == github.sha }}
run: cd dist && getfacl -R . > permissions-backup.acl
continue-on-error: true
working-directory: packages/@cdklabs/cdk-cicd-wrapper-cli
- name: "@cdklabs/cdk-cicd-wrapper-cli: Upload artifact"
if: ${{ steps.git_remote.outputs.latest_commit == github.sha }}
uses: actions/upload-artifact@v4
with:
name: cdklabs-cdk-cicd-wrapper-cli_build-artifact
path: packages/@cdklabs/cdk-cicd-wrapper-cli/dist
overwrite: true
- name: "@cdklabs/cdk-cicd-wrapper-projen: Backup artifact permissions"
if: ${{ steps.git_remote.outputs.latest_commit == github.sha }}
run: cd dist && getfacl -R . > permissions-backup.acl
continue-on-error: true
working-directory: packages/@cdklabs/cdk-cicd-wrapper-projen
- name: "@cdklabs/cdk-cicd-wrapper-projen: Upload artifact"
if: ${{ steps.git_remote.outputs.latest_commit == github.sha }}
uses: actions/upload-artifact@v4
with:
name: cdklabs-cdk-cicd-wrapper-projen_build-artifact
path: packages/@cdklabs/cdk-cicd-wrapper-projen/dist
overwrite: true
cdklabs-cdk-cicd-wrapper_release_github:
name: "@cdklabs/cdk-cicd-wrapper: Publish to GitHub Releases"
needs:
- release
- cdklabs-cdk-cicd-wrapper_release_npm
- cdklabs-cdk-cicd-wrapper_release_maven
- cdklabs-cdk-cicd-wrapper_release_pypi
- cdklabs-cdk-cicd-wrapper_release_nuget
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ needs.release.outputs.latest_commit == github.sha && needs.release.outputs.publish-cdklabs-cdk-cicd-wrapper == 'true' }}
steps:
- uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: cdklabs-cdk-cicd-wrapper_build-artifact
path: dist
- name: Restore build artifact permissions
run: cd dist && setfacl --restore=permissions-backup.acl
continue-on-error: true
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REF: ${{ github.sha }}
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
cdklabs-cdk-cicd-wrapper_release_npm:
name: "@cdklabs/cdk-cicd-wrapper: Publish to npm"
needs: release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
if: ${{ needs.release.outputs.latest_commit == github.sha && needs.release.outputs.publish-cdklabs-cdk-cicd-wrapper == 'true' }}
steps:
- uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: cdklabs-cdk-cicd-wrapper_build-artifact
path: dist
- name: Restore build artifact permissions
run: cd dist && setfacl --restore=permissions-backup.acl
continue-on-error: true
- name: Release
env:
NPM_DIST_TAG: latest
NPM_REGISTRY: registry.npmjs.org
NPM_CONFIG_PROVENANCE: "true"
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx -p publib@latest publib-npm
cdklabs-cdk-cicd-wrapper_release_maven:
name: "@cdklabs/cdk-cicd-wrapper: Publish to Maven Central"
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
if: ${{ needs.release.outputs.latest_commit == github.sha && needs.release.outputs.publish-cdklabs-cdk-cicd-wrapper == 'true' }}
steps:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11.x
- uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: cdklabs-cdk-cicd-wrapper_build-artifact
path: dist
- name: Restore build artifact permissions
run: cd dist && setfacl --restore=permissions-backup.acl
continue-on-error: true
- name: Release
env:
MAVEN_ENDPOINT: https://s01.oss.sonatype.org
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
cdklabs-cdk-cicd-wrapper_release_pypi:
name: "@cdklabs/cdk-cicd-wrapper: Publish to PyPI"
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
if: ${{ needs.release.outputs.latest_commit == github.sha && needs.release.outputs.publish-cdklabs-cdk-cicd-wrapper == 'true' }}
steps:
- uses: actions/setup-node@v4
with:
node-version: 18.x
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: cdklabs-cdk-cicd-wrapper_build-artifact
path: dist
- name: Restore build artifact permissions
run: cd dist && setfacl --restore=permissions-backup.acl
continue-on-error: true
- name: Release
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: npx -p publib@latest publib-pypi
cdklabs-cdk-cicd-wrapper_release_nuget:
name: "@cdklabs/cdk-cicd-wrapper: Publish to NuGet Gallery"
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
if: ${{ needs.release.outputs.latest_commit == github.sha && needs.release.outputs.publish-cdklabs-cdk-cicd-wrapper == 'true' }}
steps:
- uses: actions/setup-node@v4
with:
node-version: 18.x
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 3.x
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: cdklabs-cdk-cicd-wrapper_build-artifact
path: dist
- name: Restore build artifact permissions
run: cd dist && setfacl --restore=permissions-backup.acl
continue-on-error: true
- name: Release
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: npx -p publib@latest publib-nuget
cdklabs-cdk-cicd-wrapper-cli_release_github:
name: "@cdklabs/cdk-cicd-wrapper-cli: Publish to GitHub Releases"
needs:
- release
- cdklabs-cdk-cicd-wrapper-cli_release_npm
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ needs.release.outputs.latest_commit == github.sha && needs.release.outputs.publish-cdklabs-cdk-cicd-wrapper-cli == 'true' }}
steps:
- uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: cdklabs-cdk-cicd-wrapper-cli_build-artifact
path: dist
- name: Restore build artifact permissions
run: cd dist && setfacl --restore=permissions-backup.acl
continue-on-error: true
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REF: ${{ github.sha }}
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
cdklabs-cdk-cicd-wrapper-cli_release_npm:
name: "@cdklabs/cdk-cicd-wrapper-cli: Publish to npm"
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
if: ${{ needs.release.outputs.latest_commit == github.sha && needs.release.outputs.publish-cdklabs-cdk-cicd-wrapper-cli == 'true' }}
steps:
- uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: cdklabs-cdk-cicd-wrapper-cli_build-artifact
path: dist
- name: Restore build artifact permissions
run: cd dist && setfacl --restore=permissions-backup.acl
continue-on-error: true
- name: Release
env:
NPM_DIST_TAG: latest
NPM_REGISTRY: registry.npmjs.org
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx -p publib@latest publib-npm
cdklabs-cdk-cicd-wrapper-projen_release_github:
name: "@cdklabs/cdk-cicd-wrapper-projen: Publish to GitHub Releases"
needs:
- release
- cdklabs-cdk-cicd-wrapper-projen_release_npm
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ needs.release.outputs.latest_commit == github.sha && needs.release.outputs.publish-cdklabs-cdk-cicd-wrapper-projen == 'true' }}
steps:
- uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: cdklabs-cdk-cicd-wrapper-projen_build-artifact
path: dist
- name: Restore build artifact permissions
run: cd dist && setfacl --restore=permissions-backup.acl
continue-on-error: true
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REF: ${{ github.sha }}
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
cdklabs-cdk-cicd-wrapper-projen_release_npm:
name: "@cdklabs/cdk-cicd-wrapper-projen: Publish to npm"
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
if: ${{ needs.release.outputs.latest_commit == github.sha && needs.release.outputs.publish-cdklabs-cdk-cicd-wrapper-projen == 'true' }}
steps:
- uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: cdklabs-cdk-cicd-wrapper-projen_build-artifact
path: dist
- name: Restore build artifact permissions
run: cd dist && setfacl --restore=permissions-backup.acl
continue-on-error: true
- name: Release
env:
NPM_DIST_TAG: latest
NPM_REGISTRY: registry.npmjs.org
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx -p publib@latest publib-npm