Skip to content

Commit

Permalink
Create release before building
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-harding committed Mar 22, 2024
1 parent 37a0a56 commit 9d482ea
Showing 1 changed file with 51 additions and 57 deletions.
108 changes: 51 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,29 @@ permissions:
contents: write

jobs:
create-release:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
gh release create "$TAG" \
--verify-tag \
--title="${TAG}" \
--notes-from-tag
build-linux:
runs-on: ubuntu-latest
timeout-minutes: 10
needs:
- create-release

steps:
- name: Checkout repository
Expand All @@ -25,16 +45,21 @@ jobs:
- name: Build
run: cargo build --profile ci

- name: Archive artifact
uses: actions/upload-artifact@v4
with:
name: neophyte-linux
path: target/ci/neophyte
retention-days: 1
- name: Rename artifact
run: mv target/release/neophyte neophyte-linux

- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
gh release upload "$TAG" neophyte-linux
build-macos:
runs-on: macos-latest
timeout-minutes: 10
needs:
- create-release

steps:
- name: Checkout repository
Expand All @@ -48,16 +73,22 @@ jobs:
- name: Build
run: cargo build --profile ci

- name: Archive artifact
uses: actions/upload-artifact@v4
with:
name: neophyte-macos
path: target/ci/neophyte
retention-days: 1
- name: Rename artifact
run: mv target/release/neophyte neophyte-macos

- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
gh release upload "$TAG" neophyte-macos
build-windows:
runs-on: windows-latest
timeout-minutes: 10
needs:
- create-release

steps:
- name: Checkout repository
Expand All @@ -71,49 +102,12 @@ jobs:
- name: Build
run: cargo build --profile ci

- name: Archive artifact
uses: actions/upload-artifact@v4
with:
name: neophyte-windows.exe
path: target/ci/neophyte.exe
retention-days: 1

create-release:
runs-on: ubuntu-latest
timeout-minutes: 10
needs:
- build-linux
- build-macos
- build-windows

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Rename artifact
run: mv target/release/neophyte.exe neophyte-windows.exe

- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: neophyte-linux
path: neophyte-linux

- name: Download MacOS artifact
uses: actions/download-artifact@v4
with:
name: neophyte-macos
path: neophyte-macos

- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: neophyte-windows.exe
path: neophyte-windows.exe

- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
gh release create "$TAG" neophyte-linux neophyte-macos neophyte-windows.exe \
--verify-tag \
--title="${TAG}" \
--notes-from-tag
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
gh release upload "$TAG" neophyte-windows.exe

0 comments on commit 9d482ea

Please sign in to comment.