Release actions_github_com #12
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 actions_github_com | |
| on: | |
| schedule: | |
| - cron: 0 17 * * THU | |
| 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 Thursday' -- custom-resources/actions_github_com)" >> $GITHUB_OUTPUT | |
| - id: release | |
| name: Create Release Version | |
| if: steps.commits.outputs.count > 0 | |
| run: echo "version=1.$(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_actions_github_com ${{ 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_actions_github_com | |
| --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 }}/actions_github_com 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/[email protected] | |
| with: | |
| room_id: ${{ secrets.MATRIX_ROOM_ID }} | |
| access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} | |
| message: ${{ github.event.repository.name }}/actions_github_com version [${{ steps.release.outputs.version }}](${{ steps.create_release.outputs.url }}) published | |
| server: ${{ secrets.MATRIX_SERVER }} |