Skip to content

Release

Release #40

Workflow file for this run

name: Release (temporary test)
on: workflow_dispatch
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
env:
CI: "true"
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
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@1e60f620b9541d16bece96c5465dc8ee9832be0b
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:
if: false
name: Publish to npm
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
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: 3.6.0
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:
if: false
name: Publish to Maven Central
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
with:
distribution: temurin
java-version: 11.x
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
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:
if: false
name: Publish to PyPI
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: 18.x
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f
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@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: 18.x
- uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee
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: Extract Version
id: extract-version
run: echo "VERSION=$(cat dist/version.txt)" >> "${GITHUB_OUTPUT}"
- name: Log in to MongoDB Docker registry
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
with:
registry: ${{ secrets.ARTIFACTORY_REGISTRY }}
username: ${{ secrets.ARTIFACTORY_USER }}
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
- name: Sign NuGet package
run: |
docker run --platform="linux/amd64" --rm -v $(pwd):/workdir -w /workdir \
artifactory.corp.mongodb.com/release-tools-container-registry-local/azure-keyvault-nuget \
NuGetKeyVaultSignTool sign "dist/dotnet/MongoDB.AWSCDKResourcesMongoDBAtlas.${{ steps.extract-version.outputs.VERSION }}.nupkg" \
--force \
--file-digest=sha256 \
--timestamp-rfc3161=http://timestamp.digicert.com \
--timestamp-digest=sha256 \
--azure-key-vault-url=https://mdb-authenticode.vault.azure.net \
--azure-key-vault-tenant-id="${{ secrets.AZURE_NUGET_SIGN_TENANT_ID }}" \
--azure-key-vault-client-secret="${{ secrets.AZURE_NUGET_SIGN_CLIENT_SECRET }}" \
--azure-key-vault-client-id="${{ secrets.AZURE_NUGET_SIGN_CLIENT_ID }}" \
--azure-key-vault-certificate=authenticode-2021
- name: Release
if: false
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: npx -p publib@latest publib-nuget
- name: Create Issue
if: false
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:
if: false
name: Publish to GitHub Go Module Repository
needs: release
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b
with:
node-version: 18.x
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
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:
if: false
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@1e60f620b9541d16bece96c5465dc8ee9832be0b
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 }}