|
| 1 | +# SPDX-FileCopyrightText: The kube-custom-resources-rs Authors |
| 2 | +# SPDX-License-Identifier: 0BSD |
| 3 | + |
| 4 | +name: Release workspace_devfile_io |
| 5 | +on: |
| 6 | + schedule: |
| 7 | + - cron: 55 16 * * MON |
| 8 | + workflow_dispatch: |
| 9 | +jobs: |
| 10 | + release: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + permissions: |
| 13 | + contents: read |
| 14 | + steps: |
| 15 | + - id: checkout |
| 16 | + name: Checkout |
| 17 | + uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + - id: commits |
| 21 | + name: Count Commits |
| 22 | + run: echo "count=$(git rev-list --count HEAD --since='last Monday' -- custom-resources/workspace_devfile_io)" >> $GITHUB_OUTPUT |
| 23 | + - id: release |
| 24 | + name: Create Release Version |
| 25 | + if: steps.commits.outputs.count > 0 |
| 26 | + run: echo "version=1.$(date --utc +'%Y%m%d').$(date --utc +'%-H%M%S')" >> $GITHUB_OUTPUT |
| 27 | + - name: Set up Rust |
| 28 | + if: steps.commits.outputs.count > 0 |
| 29 | + uses: dtolnay/rust-toolchain@stable |
| 30 | + - name: Install cargo-workspaces |
| 31 | + uses: taiki-e/install-action@v2 |
| 32 | + with: |
| 33 | + tool: cargo-edit |
| 34 | + - name: Cargo Version |
| 35 | + if: steps.commits.outputs.count > 0 |
| 36 | + run: cargo set-version --package kcr_workspace_devfile_io ${{ steps.release.outputs.version }} |
| 37 | + - name: Publish to crates.io |
| 38 | + if: steps.commits.outputs.count > 0 |
| 39 | + run: > |
| 40 | + cargo publish |
| 41 | + --allow-dirty |
| 42 | + --token ${{ secrets.CRATES_IO_TOKEN }} |
| 43 | + --package kcr_workspace_devfile_io |
| 44 | + --jobs 1 |
| 45 | + --no-verify |
| 46 | + env: |
| 47 | + RUSTFLAGS: "-A warnings" |
| 48 | + - id: mail |
| 49 | + name: Send Mail |
| 50 | + if: steps.commits.outputs.count > 0 |
| 51 | + uses: dawidd6/action-send-mail@v5 |
| 52 | + with: |
| 53 | + server_address: ${{ secrets.MAIL_SERVER }} |
| 54 | + server_port: ${{ secrets.MAIL_PORT }} |
| 55 | + username: ${{ secrets.MAIL_USERNAME }} |
| 56 | + password: ${{ secrets.MAIL_PASSWORD }} |
| 57 | + subject: ${{ github.event.repository.name }}/workspace_devfile_io version ${{ steps.release.outputs.version }} published |
| 58 | + body: See ${{ steps.create_release.outputs.url }} for details. |
| 59 | + to: ${{ secrets.MAIL_RECIPIENT }} |
| 60 | + from: ${{ secrets.MAIL_SENDER }} |
| 61 | + - id: matrix |
| 62 | + name: Send Matrix Message |
| 63 | + if: steps.commits.outputs.count > 0 |
| 64 | + |
| 65 | + with: |
| 66 | + room_id: ${{ secrets.MATRIX_ROOM_ID }} |
| 67 | + access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} |
| 68 | + message: ${{ github.event.repository.name }}/workspace_devfile_io version [${{ steps.release.outputs.version }}](${{ steps.create_release.outputs.url }}) published |
| 69 | + server: ${{ secrets.MATRIX_SERVER }} |
0 commit comments