diff --git a/.gitattributes b/.gitattributes index a68bef6..3a967d0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,6 +7,7 @@ /.github/pull_request_template.md linguist-generated /.github/workflows/build.yml linguist-generated /.github/workflows/pull-request-lint.yml linguist-generated +/.github/workflows/release-feat/cdk-v2-upgrade.yml linguist-generated /.github/workflows/release.yml linguist-generated /.github/workflows/stale.yml linguist-generated /.gitignore linguist-generated diff --git a/.github/workflows/release-feat/cdk-v2-upgrade.yml b/.github/workflows/release-feat/cdk-v2-upgrade.yml new file mode 100644 index 0000000..251c39b --- /dev/null +++ b/.github/workflows/release-feat/cdk-v2-upgrade.yml @@ -0,0 +1,134 @@ +# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: release-feat/cdk-v2-upgrade +on: + push: + branches: + - feat/cdk-v2-upgrade + workflow_dispatch: {} +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + outputs: + latest_commit: ${{ steps.git_remote.outputs.latest_commit }} + env: + CI: "true" + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set git identity + run: |- + git config user.name "github-actions" + git config user.email "github-actions@github.com" + - name: Install dependencies + run: npm ci + - name: release:feat/cdk-v2-upgrade + run: npx projen release:feat/cdk-v2-upgrade + - name: Check for new commits + id: git_remote + run: echo ::set-output name=latest_commit::"$(git ls-remote origin -h ${{ + github.ref }} | cut -f1)" + - name: Upload artifact + if: ${{ steps.git_remote.outputs.latest_commit == github.sha }} + uses: actions/upload-artifact@v2.1.1 + with: + name: build-artifact + path: dist + container: + image: jsii/superchain:1-buster-slim + release_github: + name: Publish to GitHub Releases + needs: release + runs-on: ubuntu-latest + permissions: + contents: write + if: needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@v2 + with: + node-version: 14.x + - name: Download build artifacts + uses: actions/download-artifact@v2 + with: + name: build-artifact + path: dist + - name: Prepare Repository + run: mv dist .repo + - name: Collect GitHub Metadata + run: mv .repo/dist dist + - name: Release + 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 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_REF: ${{ github.ref }} + release_npm: + name: Publish to npm + needs: release + runs-on: ubuntu-latest + permissions: + contents: read + if: needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@v2 + with: + node-version: 14.x + - name: Download build artifacts + uses: actions/download-artifact@v2 + with: + name: build-artifact + path: dist + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && npm ci + - name: Create js artifact + run: cd .repo && npx projen package:js + - name: Collect js Artifact + run: mv .repo/dist dist + - name: Release + run: npx -p jsii-release@latest jsii-release-npm + env: + NPM_DIST_TAG: next + NPM_REGISTRY: registry.npmjs.org + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + release_pypi: + name: Publish to PyPI + needs: release + runs-on: ubuntu-latest + permissions: + contents: read + if: needs.release.outputs.latest_commit == github.sha + steps: + - uses: actions/setup-node@v2 + with: + node-version: 14.x + - uses: actions/setup-python@v2 + with: + python-version: 3.x + - name: Download build artifacts + uses: actions/download-artifact@v2 + with: + name: build-artifact + path: dist + - name: Prepare Repository + run: mv dist .repo + - name: Install Dependencies + run: cd .repo && npm ci + - name: Create python artifact + run: cd .repo && npx projen package:python + - name: Collect python Artifact + run: mv .repo/dist dist + - name: Release + run: npx -p jsii-release@latest jsii-release-pypi + env: + TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} diff --git a/.gitignore b/.gitignore index 6ce9676..2699303 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ junit.xml /dist/changelog.md /dist/version.txt !/.github/workflows/release.yml +!/.github/workflows/release-feat/cdk-v2-upgrade.yml !/.github/dependabot.yml !/.github/pull_request_template.md !/test/ diff --git a/.projen/files.json b/.projen/files.json index d2b6f26..03ac54b 100644 --- a/.projen/files.json +++ b/.projen/files.json @@ -6,6 +6,7 @@ ".github/pull_request_template.md", ".github/workflows/build.yml", ".github/workflows/pull-request-lint.yml", + ".github/workflows/release-feat/cdk-v2-upgrade.yml", ".github/workflows/release.yml", ".github/workflows/stale.yml", ".gitignore", diff --git a/.projen/tasks.json b/.projen/tasks.json index 90f1d37..36d26f2 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -182,7 +182,34 @@ "name": "release", "description": "Prepare a release from \"main\" branch", "env": { - "RELEASE": "true" + "RELEASE": "true", + "MAJOR": "1" + }, + "steps": [ + { + "exec": "rm -fr dist" + }, + { + "spawn": "bump" + }, + { + "spawn": "build" + }, + { + "spawn": "unbump" + }, + { + "exec": "git diff --ignore-space-at-eol --exit-code" + } + ] + }, + "release:feat/cdk-v2-upgrade": { + "name": "release:feat/cdk-v2-upgrade", + "description": "Prepare a release from \"feat/cdk-v2-upgrade\" branch", + "env": { + "RELEASE": "true", + "MAJOR": "2", + "PRERELEASE": "alpha" }, "steps": [ { diff --git a/.projenrc.js b/.projenrc.js index 603efc9..abe54e7 100644 --- a/.projenrc.js +++ b/.projenrc.js @@ -18,6 +18,16 @@ const project = new awscdk.AwsCdkConstructLibrary({ 'amplify', ], + // Until we merge v2 into main + majorVersion: 1, + releaseBranches: { + 'feat/cdk-v2-upgrade': { + majorVersion: 2, + npmDistTag: 'next', + prerelease: 'alpha', + }, + }, + codeCov: true, githubOptions: { mergify: false, diff --git a/package.json b/package.json index cc3d06f..d77adbd 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "post-compile": "npx projen post-compile", "pre-compile": "npx projen pre-compile", "release": "npx projen release", + "release:feat/cdk-v2-upgrade": "npx projen release:feat/cdk-v2-upgrade", "test": "npx projen test", "test:update": "npx projen test:update", "test:watch": "npx projen test:watch",