Skip to content

Commit

Permalink
fix(ci): Simplify release process.
Browse files Browse the repository at this point in the history
Run all publishing tasks in the same workflow.
  • Loading branch information
calavera committed Nov 21, 2024
1 parent a317141 commit 4ad370e
Showing 1 changed file with 7 additions and 156 deletions.
163 changes: 7 additions & 156 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,189 +57,40 @@ jobs:
python-version: 3.12.3
- name: Install NPM dependencies
run: npx projen install:ci
- name: release
- name: Build
run: npx projen build --verbose
- name: Release
run: npx projen release
- name: Backup artifact permissions
run: cd dist && getfacl -R . > permissions-backup.acl
continue-on-error: true
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifact
path: dist
- name: Release GitHub
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
release_npm:
name: Publish to npm
needs: release_github
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Download build artifacts
uses: actions/download-artifact@v3
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 && npx projen install:ci
- name: Create JS artifact
run: cd .repo && npx projen package:js
- name: Collect js Artifact
run: mv .repo/dist dist
- name: Release JS Artifact
env:
NPM_DIST_TAG: latest
NPM_REGISTRY: registry.npmjs.org
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx -p publib@latest publib-npm
release_maven:
name: Publish to Maven Central
needs: release_github
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17.x'
- uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Download build artifacts
uses: actions/download-artifact@v3
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 && npx projen install:ci
- name: Create java artifact
run: cd .repo && npx projen package:java
- name: Collect java Artifact
run: mv .repo/dist dist
- name: Release
- name: Release Java Artifact
env:
MAVEN_SERVER_ID: 'github'
MAVEN_REPOSITORY_URL: 'https://maven.pkg.github.com/cargo-lambda/cargo-lambda-cdk'
MAVEN_ENDPOINT: 'https://maven.pkg.github.com'
MAVEN_USERNAME: ${{ github.actor }}
MAVEN_PASSWORD: ${{ secrets.CDK_PACKAGES_REGISTRY_GITHUB_TOKEN }}
run: npx -p publib@latest publib-maven
release_pypi:
name: Publish to PyPI
needs: release_github
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/setup-node@v4
with:
node-version: 20.x
- uses: actions/setup-python@v5
with:
python-version: 3.12.3
- name: Download build artifacts
uses: actions/download-artifact@v3
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 && npx projen install:ci
- name: Create python artifact
run: cd .repo && npx projen package:python
- name: Collect python Artifact
run: mv .repo/dist dist
- name: Release
- name: Release Python Artifact
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: npx -p publib@latest publib-pypi
release_nuget:
name: Publish to NuGet Gallery
needs: release_github
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/setup-node@v4
with:
node-version: 20.x
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 3.x
- name: Download build artifacts
uses: actions/download-artifact@v3
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 && npx projen install:ci
- name: Create dotnet artifact
run: cd .repo && npx projen package:dotnet
- name: Collect dotnet Artifact
run: mv .repo/dist dist
- name: Release
- name: Release Dotnet Artifact
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: npx -p publib@latest publib-nuget
release_golang:
name: Publish to GitHub Go Module Repository
needs: release_github
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/setup-node@v4
with:
node-version: 20.x
- uses: actions/setup-go@v4
with:
go-version: ^1.16.0
- name: Download build artifacts
uses: actions/download-artifact@v3
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 && npx projen install:ci
- name: Create go artifact
run: cd .repo && npx projen package:go
- name: Collect go Artifact
run: mv .repo/dist dist
- name: Release
- name: Release Go Artifact
env:
GIT_USER_NAME: github-actions
GIT_USER_EMAIL: [email protected]
Expand Down

0 comments on commit 4ad370e

Please sign in to comment.