|
1 | | -name: Bump Version and Test |
| 1 | +name: Build and Test |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: [ "main" ] |
6 | | - workflow_dispatch: |
7 | | - inputs: |
8 | | - version: |
9 | | - required: true |
10 | | - type: string |
11 | | - description: 'Version to deploy (e.g., 1.0.0)' |
12 | 6 |
|
13 | 7 | env: |
14 | 8 | CARGO_TERM_COLOR: always |
15 | 9 |
|
16 | 10 | jobs: |
17 | | - update_version: |
18 | | - permissions: |
19 | | - contents: write |
20 | | - runs-on: ubuntu-latest |
21 | | - outputs: |
22 | | - new_tag: ${{ steps.tag_version.outputs.new_tag }} |
23 | | - previous_tag: ${{ steps.tag_version.outputs.previous_tag }} |
24 | | - changelog: ${{ steps.tag_version.outputs.changelog }} |
25 | | - steps: |
26 | | - - name: Validate Input Version |
27 | | - if: github.event_name == 'workflow_dispatch' |
28 | | - run: | |
29 | | - if [[ ! "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
30 | | - echo "Invalid format. Expected X.Y.Z" |
31 | | - exit 1 |
32 | | - fi |
33 | | - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
34 | | - - name: Bump version and push tag |
35 | | - id: tag_version |
36 | | - uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b |
37 | | - with: |
38 | | - dry_run: true |
39 | | - github_token: ${{ secrets.GITHUB_TOKEN }} |
40 | | - custom_tag: ${{ github.event.inputs.version }} |
41 | | - - name: Apply Updated Version to Cargo.toml |
42 | | - run: | |
43 | | - sed -i -r 's/^version = "[0-9]+.[0-9]+.[0-9]+"$/version = "${{ steps.tag_version.outputs.new_version }}"/' Cargo.toml |
44 | | - cat -e Cargo.toml |
45 | | - cargo publish --dry-run --allow-dirty |
46 | | - - uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 |
47 | | - with: |
48 | | - tag_name: ${{ steps.tag_version.outputs.new_tag }} |
49 | | - commit_message: "sync version in Cargo.toml to ${{ steps.tag_version.outputs.new_version }}" |
50 | 11 | build-and-test: |
51 | | - needs: update_version |
52 | 12 | strategy: |
53 | 13 | matrix: |
54 | 14 | include: |
|
67 | 27 | runs-on: ${{ matrix.os }} |
68 | 28 | steps: |
69 | 29 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
70 | | - with: |
71 | | - ref: ${{ needs.update_version.outputs.new_tag }} |
72 | 30 | - name: Setup Rust Toolchain for GitHub CI |
73 | 31 | uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 |
74 | 32 | with: |
|
81 | 39 | override: # optional, default is true |
82 | 40 | - name: Test |
83 | 41 | run: cargo test --verbose |
84 | | - release: |
85 | | - needs: [build-and-test, update_version] |
86 | | - permissions: |
87 | | - contents: write |
88 | | - uses: DavidLee18/aws_cli/.github/workflows/release.yml@main |
89 | | - with: |
90 | | - tag: ${{ needs.update_version.outputs.new_tag }} |
0 commit comments