Release operator_cluster_x_k8s_io #36
This file contains hidden or 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
| # SPDX-FileCopyrightText: The kube-custom-resources-rs Authors | |
| # SPDX-License-Identifier: 0BSD | |
| name: Release operator_cluster_x_k8s_io | |
| on: | |
| schedule: | |
| - cron: 52 21 * * TUE | |
| workflow_dispatch: | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - id: checkout | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - id: commits | |
| name: Count Commits | |
| run: echo "count=$(git rev-list --count HEAD --since='last Tuesday' -- custom-resources/operator_cluster_x_k8s_io)" >> $GITHUB_OUTPUT | |
| - id: release | |
| name: Create Release Version | |
| if: steps.commits.outputs.count > 0 | |
| run: echo "version=2.$(date --utc +'%Y%m%d').$(date --utc +'%-H%M%S')" >> $GITHUB_OUTPUT | |
| - name: Set up Rust | |
| if: steps.commits.outputs.count > 0 | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-workspaces | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-edit | |
| - name: Cargo Version | |
| if: steps.commits.outputs.count > 0 | |
| run: cargo set-version --package kcr_operator_cluster_x_k8s_io ${{ steps.release.outputs.version }} | |
| - name: Publish to crates.io | |
| if: steps.commits.outputs.count > 0 | |
| run: > | |
| cargo publish | |
| --allow-dirty | |
| --token ${{ secrets.CRATES_IO_TOKEN }} | |
| --package kcr_operator_cluster_x_k8s_io | |
| --jobs 1 | |
| --no-verify | |
| env: | |
| RUSTFLAGS: "-A warnings" | |
| - id: mail | |
| name: Send Mail | |
| if: steps.commits.outputs.count > 0 | |
| uses: dawidd6/action-send-mail@v5 | |
| with: | |
| server_address: ${{ secrets.MAIL_SERVER }} | |
| server_port: ${{ secrets.MAIL_PORT }} | |
| username: ${{ secrets.MAIL_USERNAME }} | |
| password: ${{ secrets.MAIL_PASSWORD }} | |
| subject: ${{ github.event.repository.name }}/operator_cluster_x_k8s_io version ${{ steps.release.outputs.version }} published | |
| body: See ${{ steps.create_release.outputs.url }} for details. | |
| to: ${{ secrets.MAIL_RECIPIENT }} | |
| from: ${{ secrets.MAIL_SENDER }} | |
| - id: matrix | |
| name: Send Matrix Message | |
| if: steps.commits.outputs.count > 0 | |
| uses: s3krit/matrix-message-action@v0.0.3 | |
| with: | |
| room_id: ${{ secrets.MATRIX_ROOM_ID }} | |
| access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} | |
| message: ${{ github.event.repository.name }}/operator_cluster_x_k8s_io version [${{ steps.release.outputs.version }}](${{ steps.create_release.outputs.url }}) published | |
| server: ${{ secrets.MATRIX_SERVER }} |