|
3 | 3 | workflow_dispatch: |
4 | 4 | inputs: |
5 | 5 | version: |
6 | | - description: "version number" |
| 6 | + description: "version" |
7 | 7 | required: true |
8 | 8 |
|
9 | | -env: |
10 | | - RELEASE_FILE: RELEASE.txt |
11 | | - |
12 | 9 | jobs: |
13 | | - check: |
14 | | - name: check (${{ matrix.name }}) |
15 | | - runs-on: ubuntu-latest |
16 | | - strategy: |
17 | | - matrix: |
18 | | - include: |
19 | | - - name: "default" |
20 | | - features: "" |
21 | | - - name: "all" |
22 | | - features: --all-features |
23 | | - - name: "backend+ui" |
24 | | - features: --features "backend+ui" --no-default-features |
25 | | - steps: |
26 | | - - uses: actions/checkout@v1 |
27 | | - - name: install tools |
28 | | - run: sudo apt-get install build-essential libncurses5-dev libncursesw5-dev |
29 | | - - name: execute tests |
30 | | - run: cargo test ${{ matrix.features }} |
31 | | - - name: build program |
32 | | - run: cargo build ${{ matrix.features }} |
33 | | - - name: run cli tests |
34 | | - working-directory: test |
35 | | - run: sh test-cli.sh |
36 | | - |
37 | | - tag: |
| 10 | + version: |
| 11 | + name: version |
38 | 12 | if: github.ref == 'refs/heads/master' |
39 | | - needs: check |
40 | | - name: tag and release |
41 | 13 | runs-on: ubuntu-latest |
| 14 | + outputs: |
| 15 | + version: ${{ steps.export.outputs.version }} |
| 16 | + upload_url: ${{ steps.releaseExp.outputs.upload_url }} |
42 | 17 | steps: |
43 | | - - uses: actions/checkout@v1 |
44 | | - - name: create release |
45 | | - id: create_release |
46 | | - uses: actions/create-release@latest |
47 | | - env: |
48 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
49 | | - with: |
50 | | - tag_name: ${{ github.event.inputs.version }} |
51 | | - release_name: ${{ github.event.inputs.version }} |
52 | | - body: | |
53 | | - Release ${{ github.event.inputs.version }}. |
54 | | - draft: false |
55 | | - prerelease: false |
56 | | - - run: printf ${{ steps.create_release.outputs.upload_url }} > ${{ env.RELEASE_FILE }} |
57 | | - - name: upload release data |
58 | | - |
| 18 | + - id: export |
| 19 | + run: 'printf "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT' |
| 20 | + - id: release |
| 21 | + name: Create Release |
| 22 | + |
59 | 23 | with: |
60 | | - name: RELEASE |
61 | | - path: ${{ env.RELEASE_FILE }} |
| 24 | + tag: ${{ github.event.inputs.version }} |
| 25 | + allowUpdates: true |
| 26 | + removeArtifacts: true |
| 27 | + makeLatest: true |
| 28 | + - id: releaseExp |
| 29 | + run: 'printf "upload_url=${{ steps.release.outputs.upload_url }}" >> $GITHUB_OUTPUT' |
62 | 30 |
|
63 | | - publish-cratesio: |
64 | | - needs: tag |
65 | | - name: crates.io |
| 31 | + crates-io: |
| 32 | + name: "crates.io" |
| 33 | + if: github.ref == 'refs/heads/master' |
66 | 34 | runs-on: ubuntu-latest |
| 35 | + needs: |
| 36 | + - version |
67 | 37 | steps: |
68 | | - - uses: actions/checkout@v1 |
69 | | - - name: get version |
70 | | - id: get_version |
71 | | - run: echo ::set-output name=VERSION::$(git tag --points-at HEAD --sort -version:refname | head -1) |
72 | | - - name: install tools |
73 | | - run: | |
74 | | - sudo apt-get install build-essential libncurses5-dev libncursesw5-dev |
| 38 | + - uses: actions/checkout@v3 |
| 39 | + - name: install rust |
| 40 | + run: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y" |
75 | 41 | - name: publish |
76 | | - id: publish |
77 | 42 | run: | |
78 | | - sed 's/version = "0.0.0"/version = "'${{ steps.get_version.outputs.VERSION }}'"/g' Cargo.toml > Cargo.toml.tmp |
79 | | - mv Cargo.toml.tmp Cargo.toml |
80 | 43 | cargo login ${{ secrets.CRATES_IO_TOKEN }} |
| 44 | + sed 's/version = "0.0.0"/version = "'${{ needs.version.outputs.version }}'"/g' Cargo.toml > Cargo.toml.tmp |
| 45 | + mv Cargo.toml.tmp Cargo.toml |
81 | 46 | cargo publish --allow-dirty |
82 | 47 |
|
83 | | - publish: |
84 | | - needs: tag |
85 | | - name: publish for ${{ matrix.os }} |
86 | | - runs-on: ${{ matrix.os }} |
87 | | - strategy: |
88 | | - matrix: |
89 | | - include: |
90 | | - - os: macos-latest |
91 | | - target: x86_64-apple-darwin |
92 | | - install: printf ok |
93 | | - - os: ubuntu-latest |
94 | | - target: x86_64-unknown-linux-gnu |
95 | | - install: sudo apt-get install build-essential libncurses5-dev libncursesw5-dev |
| 48 | + deb: |
| 49 | + name: "deb" |
| 50 | + if: github.ref == 'refs/heads/master' |
| 51 | + runs-on: ubuntu-latest |
| 52 | + needs: |
| 53 | + - version |
| 54 | + - crates-io |
96 | 55 | steps: |
97 | | - - uses: actions/checkout@v1 |
98 | | - - name: get version |
99 | | - id: get_version |
100 | | - run: echo ::set-output name=VERSION::$(git tag --points-at HEAD --sort -version:refname | head -1) |
101 | | - - name: download release id |
102 | | - |
103 | | - with: |
104 | | - name: RELEASE |
105 | | - - name: get release data |
106 | | - id: get_release_data |
107 | | - run: echo ::set-output name=upload_url::$(cat RELEASE/${{ env.RELEASE_FILE }}) |
108 | | - - name: install tools |
| 56 | + - uses: actions/checkout@v3 |
| 57 | + - run: | |
| 58 | + sudo apt-get install -y curl |
| 59 | + - name: install rust |
109 | 60 | run: | |
110 | | - ${{ matrix.install }} |
111 | | - rustup target install ${{ matrix.target }} |
112 | | - - name: build-${{ matrix.target }} |
| 61 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 62 | + cargo install cargo-deb |
| 63 | + - name: publish |
113 | 64 | run: | |
114 | | - sed 's/version = "0.0.0"/version = "'${{ steps.get_version.outputs.VERSION }}'"/g' Cargo.toml > Cargo.toml.tmp |
| 65 | + sed 's/version = "0.0.0"/version = "'${{ needs.version.outputs.version }}'"/g' Cargo.toml > Cargo.toml.tmp |
115 | 66 | mv Cargo.toml.tmp Cargo.toml |
116 | | - RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target ${{ matrix.target }} |
117 | | - - name: zip |
118 | | - run: cd ./target/${{ matrix.target }}/release && tar -zcvf ${{ matrix.target }}.tar.gz complate |
119 | | - - name: upload asset |
120 | | - uses: svenstaro/upload-release-action@v1-release |
| 67 | + cargo deb |
| 68 | + - name: Upload Release Asset |
| 69 | + id: upload-release-asset |
| 70 | + uses: actions/upload-release-asset@v1 |
| 71 | + env: |
| 72 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
121 | 73 | with: |
122 | | - repo_token: ${{ secrets.GITHUB_TOKEN }} |
123 | | - file: ./target/${{ matrix.target }}/release/${{ matrix.target }}.tar.gz |
124 | | - asset_name: ${{ matrix.target }}.tar.gz |
125 | | - tag: ${{ steps.get_version.outputs.VERSION }} |
126 | | - overwrite: true |
| 74 | + upload_url: ${{ needs.version.outputs.upload_url }} |
| 75 | + asset_path: ./target/debian/complate_${{ needs.version.outputs.version }}_amd64.deb |
| 76 | + asset_name: complate_${{ needs.version.outputs.version }}_amd64.deb |
| 77 | + asset_content_type: application/octet-stream |
0 commit comments