feat: Introduce Dummy Action #34
Workflow file for this run
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: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
id-token: write | |
contents: write | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
release-jvm: | |
name: Release JVM | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
env: | |
JAVA_OPTS: "-Xmx4G" | |
SBT_OPTS: "-Dsbt.ci=true" | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '21' | |
- name: Setup sbt | |
uses: sbt/setup-sbt@v1 | |
- name: Prepare environment | |
env: | |
SONATYPE_SBT: ${{ secrets.SONATYPE_SBT }} | |
SONATYPE_PGP_SECRET: ${{ secrets.SONATYPE_PGP_SECRET }} | |
run: | | |
mkdir --parents ~/.sbt/1.0 || true | |
echo "$SONATYPE_SBT" > ~/.sbt/1.0/sonatype.sbt | |
echo -n "$SONATYPE_PGP_SECRET" | base64 --decode | gpg --batch --import | |
- name: Deploy Java adapter | |
id: deploy-jvm | |
env: | |
PGP_PASSPHRASE: ${{ secrets.SONATYPE_PGP_PASSPHRASE }} | |
working-directory: ./jvm | |
run: | | |
sbt "project gatling-jvm-to-js-adapter" "release with-defaults" | |
- name: Setup version | |
id: version | |
run: | | |
version="$(cat jvm/adapter/target/release-info)" | |
echo "version=$version" | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-jvm-workdir | |
include-hidden-files: true | |
path: | | |
. | |
!.git/ | |
retention-days: 7 | |
release-js: | |
name: Release JS | |
needs: release-jvm | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
environment: | |
name: npm | |
url: https://www.npmjs.com/org/gatling.io | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-jvm-workdir | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Deploy JS packages | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
working-directory: ./js | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc | |
npm ci | |
npm version "${{ needs.release-jvm.outputs.version }}" | |
npm run build --workspaces | |
for pkg in "cli" "jvm-types" "core" "http"; do | |
cp ../LICENSE "./$pkg/LICENSE" | |
npm publish --access public "[email protected]/$pkg" | |
done | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-js-workdir | |
include-hidden-files: true | |
path: | | |
. | |
!.git/ | |
retention-days: 7 | |
create-github-release: | |
name: Create GitHub release (draft) | |
needs: | |
- release-jvm | |
- release-js | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
environment: | |
name: GitHub release (draft) | |
url: ${{ steps.release.outputs.html_url }} | |
outputs: | |
prerelease: ${{ steps.release.outputs.prerelease }} | |
url: ${{ steps.release.outputs.url }} | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
steps: | |
- name: Create GitHub release (draft) | |
id: release | |
run: | | |
version="${{ needs.release-jvm.outputs.version }}" | |
if [[ "$version" =~ -M[0-9]+$ ]]; then | |
prerelease=true | |
else | |
prerelease=false | |
fi | |
echo "prerelease=$prerelease" | |
echo "prerelease=$prerelease" >> $GITHUB_OUTPUT | |
releases_url=$(echo "${{ github.event.repository.releases_url }}" | sed 's/{\/id}//') | |
response=$(curl \ | |
--fail-with-body \ | |
--location \ | |
--show-error \ | |
--silent \ | |
--request POST \ | |
--header "Accept: application/vnd.github+json" \ | |
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
--header "X-GitHub-Api-Version: 2022-11-28" \ | |
"$releases_url" \ | |
--data @- <<EOF | |
{ | |
"name": "Gatling JS $version", | |
"tag_name": "${{ github.ref_name }}", | |
"body": "To get started with Gatling JS, please check [the tutorial](https://docs.gatling.io/tutorials/scripting-intro-js/).\n\nThe bundle files in this release are normally automatically downloaded by the Gatling JS CLI. If you need to perform a manual install, please refer to [the documentation](https://docs.gatling.io/reference/integrations/build-tools/js-cli/).", | |
"draft": true, | |
"prerelease": $prerelease | |
} | |
EOF | |
) | |
echo "response=$response" | |
url=$(echo "$response" | jq --raw-output ".url") | |
echo "url=$url" | |
echo "url=$url" >> $GITHUB_OUTPUT | |
html_url=$(echo "$response" | jq --raw-output ".html_url") | |
echo "html_url=$html_url" | |
echo "html_url=$html_url" >> $GITHUB_OUTPUT | |
upload_url=$(echo "$response" | jq --raw-output ".upload_url") | |
echo "upload_url=$upload_url" | |
echo "upload_url=$upload_url" >> $GITHUB_OUTPUT | |
build-linux-x64: | |
name: Build bundle for Linux x64 | |
needs: | |
- release-jvm | |
- create-github-release | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-js-workdir | |
- name: Build and upload bundle | |
uses: ./.github/actions/build-and-upload-bundle | |
with: | |
version: ${{ needs.release-jvm.outputs.version }} | |
upload-url: ${{ needs.create-github-release.outputs.upload_url }} | |
os-type: Linux | |
os-arch: x64 | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
build-linux-arm64: | |
name: Build bundle for Linux ARM64 | |
needs: | |
- release-jvm | |
- create-github-release | |
runs-on: ubuntu-24-arm-2-cores | |
timeout-minutes: 5 | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-js-workdir | |
- name: Build and upload bundle | |
uses: ./.github/actions/build-and-upload-bundle | |
with: | |
version: ${{ needs.release-jvm.outputs.version }} | |
upload-url: ${{ needs.create-github-release.outputs.upload_url }} | |
os-type: Linux | |
os-arch: arm64 | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
build-macos-x64: | |
name: Build bundle for macOS x64 | |
needs: | |
- release-jvm | |
- create-github-release | |
runs-on: macos-13 | |
timeout-minutes: 5 | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-js-workdir | |
- name: Build and upload bundle | |
uses: ./.github/actions/build-and-upload-bundle | |
with: | |
version: ${{ needs.release-jvm.outputs.version }} | |
upload-url: ${{ needs.create-github-release.outputs.upload_url }} | |
os-type: Darwin | |
os-arch: x64 | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
build-macos-arm64: | |
name: Build bundle for macOS ARM64 | |
needs: | |
- release-jvm | |
- create-github-release | |
runs-on: macos-14 | |
timeout-minutes: 5 | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-js-workdir | |
- name: Build and upload bundle | |
uses: ./.github/actions/build-and-upload-bundle | |
with: | |
version: ${{ needs.release-jvm.outputs.version }} | |
upload-url: ${{ needs.create-github-release.outputs.upload_url }} | |
os-type: Darwin | |
os-arch: arm64 | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
build-windows-x64: | |
name: Build bundle for Windows x64 | |
needs: | |
- release-jvm | |
- create-github-release | |
runs-on: windows-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-js-workdir | |
- name: Build and upload bundle | |
uses: ./.github/actions/build-and-upload-bundle | |
with: | |
version: ${{ needs.release-jvm.outputs.version }} | |
upload-url: ${{ needs.create-github-release.outputs.upload_url }} | |
os-type: Windows_NT | |
os-arch: x64 | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
publish-github-release: | |
name: Publish GitHub release | |
needs: | |
- create-github-release | |
- build-linux-x64 | |
- build-linux-arm64 | |
- build-macos-x64 | |
- build-macos-arm64 | |
- build-windows-x64 | |
runs-on: ubuntu-latest | |
timeout-minutes: 2 | |
environment: | |
name: GitHub release | |
url: ${{ steps.release.outputs.html_url }} | |
steps: | |
- name: Publish GitHub release | |
id: release | |
run: | | |
prerelease="${{ needs.create-github-release.outputs.prerelease }}" | |
if [[ "$prerelease" = "true" ]]; then | |
make_latest=false | |
else | |
make_latest=true | |
fi | |
response=$(curl \ | |
--fail-with-body \ | |
--location \ | |
--show-error \ | |
--silent \ | |
--request PATCH \ | |
--header "Accept: application/vnd.github+json" \ | |
--header "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
--header "X-GitHub-Api-Version: 2022-11-28" \ | |
"${{ needs.create-github-release.outputs.url }}" \ | |
--data @- <<EOF | |
{ | |
"draft": false, | |
"make_latest": $make_latest | |
} | |
EOF | |
) | |
echo "response=$response" | |
html_url=$(echo "$response" | jq --raw-output ".html_url") | |
echo "html_url=$html_url" | |
echo "html_url=$html_url" >> $GITHUB_OUTPUT |