rust release #737
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: rust release | |
on: | |
workflow_dispatch: | |
inputs: | |
type: | |
required: true | |
default: 'stable' | |
description: 'Available values: `beta` and `stable`' | |
update_changelog: | |
required: false | |
description: 'Enables/disables Rust changelog update' | |
schedule: | |
- cron: '0 3 * * *' | |
jobs: | |
generate-build-number: | |
runs-on: ubuntu-latest | |
outputs: | |
build_number: ${{ steps.buildnumber.outputs.build_number }} | |
steps: | |
- name: Generate build number | |
uses: einaregilsson/build-number@v3 | |
id: buildnumber | |
with: | |
token: ${{ secrets.github_token }} | |
prefix: rust | |
get-release-branch: | |
runs-on: ubuntu-latest | |
outputs: | |
release-branch: ${{ steps.get-release-branch.outputs.release-branch }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- id: get-release-branch | |
run: | | |
branch=$(python scripts/get_release_branch.py) | |
echo "release-branch=$branch" >> $GITHUB_OUTPUT | |
update-changelog-link: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.WORKFLOW_GITHUB_TOKEN }} | |
- run: git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* | |
- name: Set up git user | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "intellij-rust-bot" | |
- name: Update changelog link | |
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'stable' && github.event.inputs.update_changelog != 'false' | |
run: python scripts/update_changelog_link.py | |
get-channel: | |
runs-on: ubuntu-latest | |
outputs: | |
channel: ${{ steps.get-channel.outputs.channel }} | |
steps: | |
- id: get-channel | |
run: | | |
if ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'stable' }} | |
then | |
echo "channel=stable" >> $GITHUB_OUTPUT | |
else | |
echo "channel=beta" >> $GITHUB_OUTPUT | |
fi | |
fetch-latest-changes: | |
runs-on: ubuntu-latest | |
needs: [ get-release-branch, update-changelog-link, get-channel ] | |
outputs: | |
rust-commit: ${{ steps.fetch-commits.outputs.rust-commit }} | |
rust-release: ${{ steps.fetch-commits.outputs.rust-release }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.get-release-branch.outputs.release-branch }} | |
fetch-depth: 0 | |
- name: Fetch latest commits | |
id: fetch-commits | |
run: | | |
echo "rust-commit=$(git log -n 1 --format=format:%H)" >> $GITHUB_OUTPUT | |
echo "rust-release=$(python scripts/get_tag_commit.py --tag "rust-${{ needs.get-channel.outputs.channel }}")" >> $GITHUB_OUTPUT | |
- name: Show commits | |
run: | | |
echo "rust-commit: ${{ steps.fetch-commits.outputs.rust-commit }}" | |
echo "rust-release: ${{ steps.fetch-commits.outputs.rust-release }}" | |
build-native-code: | |
if: needs.fetch-latest-changes.outputs.rust-commit != needs.fetch-latest-changes.outputs.rust-release | |
needs: [ fetch-latest-changes ] | |
uses: ./.github/workflows/build-native-code.yml | |
with: | |
rust-version: stable | |
cache: false | |
build: | |
if: needs.fetch-latest-changes.outputs.rust-commit != needs.fetch-latest-changes.outputs.rust-release | |
needs: [ generate-build-number, get-release-branch, update-changelog-link, get-channel, fetch-latest-changes, build-native-code ] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
platform-version: [ 223, 231 ] | |
env: | |
ORG_GRADLE_PROJECT_buildNumber: ${{ needs.generate-build-number.outputs.build_number }} | |
ORG_GRADLE_PROJECT_platformVersion: ${{ matrix.platform-version }} | |
ORG_GRADLE_PROJECT_enableBuildSearchableOptions: true | |
ORG_GRADLE_PROJECT_publishChannel: ${{ needs.get-channel.outputs.channel }} | |
ORG_GRADLE_PROJECT_publishToken: ${{ secrets.plugin_bot_token }} | |
ORG_GRADLE_PROJECT_compileNativeCode: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.get-release-branch.outputs.release-branch }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: corretto | |
java-version: 17 | |
- name: Load native binaries | |
uses: ./.github/actions/load-native-binaries | |
- name: Publish rust plugin | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: ":plugin:publishPlugin" | |
cache-disabled: true | |
save-commit: | |
needs: [ get-channel, fetch-latest-changes, build ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.WORKFLOW_GITHUB_TOKEN }} | |
- name: Save commits | |
run: | | |
python scripts/save_tag.py --tag rust-${{ needs.get-channel.outputs.channel }} --commit ${{ needs.fetch-latest-changes.outputs.rust-commit }} |