aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/release.yaml
blob: 7998f1e4cf8da50e65308eec5e676eea2b254176 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
on:
  push:
    tags:
      - 'v*'
name: Release

jobs:
  create_release:
    name: Create Release
    runs-on: ubuntu-latest
    steps:
      - name: Delete Previous Draft Releases
        uses: jakeswenson/action-delete-latest-release@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
      - name: Checkout # needed so that changelog generator can pull the latest release tag
        uses: actions/checkout@v2
      - name: Generate changelog
        id: changelog
        uses: metcalfc/changelog-generator@v1.0.0
        with:
          myToken: ${{ secrets.GITHUB_TOKEN }}
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: ${{ github.ref }}
          body: ${{ steps.changelog.outputs.changelog }}
          draft: true
          prerelease: false
    outputs:
      upload_url: ${{ steps.create_release.outputs.upload_url }}

  build-release:
    name: Release Build
    needs: create_release
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Release Build
        uses: actions-rs/cargo@v1
        with:
          command: build
          args: --release --all-features
      - name: Cargo Publish
        uses: actions-rs/cargo@v1
        with:
          command: publish
          args: --token "${{secrets.crates_token}}"