Skip to content

Commit

Permalink
update workflows to not make linux & macos
Browse files Browse the repository at this point in the history
  • Loading branch information
svdgoor committed Apr 22, 2023
1 parent aba1ad1 commit b1b33dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 223 deletions.
109 changes: 3 additions & 106 deletions .github/workflows/prerelease-on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }} # The token to use to authenticate with Github
allowUpdates: true # Allow the release to be updated
generateReleaseNotes: true # Generate release notes from the commits
draft: true # If the release should be a draft
draft: false # If the release should be a draft
prerelease: true # If the release should be a pre-release
makeLatest: false # If the release should be marked as the latest release
artifactErrorsFailBuild: true # If the build should fail if the artifact cannot be added to the release
updateOnlyUnreleased: true # If the build should fail if the release is not a draft or pre-release

Expand All @@ -56,108 +57,4 @@ jobs:
with:
name: "${{ env.RELEASE_NAME_WIN }}.exe"
path: "${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_WIN }}.exe"
retention-days: 5

build_and_release_linux:
name: Build and Release Linux

runs-on: ubuntu-latest

env:
RELEASE_NAME_LINUX: "${{ github.event.repository.name }}-${{ github.ref_name }}-Linux"
OUTPUT_DIR: "./target/release"

steps:
- uses: actions/checkout@v3 # Same as with Windows

# Install required tools for Linux
- name: Install required tools
run: sudo apt install libdbus-1-dev pkg-config libudev-dev

- name: Build Release # Same as with Windows
run: cargo build --release

- name: Rename Artifact # Same as with Windows
run: mv ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_NAME }} ${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_LINUX }}

- name: Add Artifact To Github Release # Same as with Windows
uses: ncipollo/release-action@v1
with:
artifacts: "${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_LINUX }}"
replacesArtifacts: false
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
generateReleaseNotes: true
draft: true
prerelease: true
artifactErrorsFailBuild: true
updateOnlyUnreleased: true

- name: Add Artifact To Action Job # Same as with Windows
uses: actions/upload-artifact@v3
with:
name: "${{ env.RELEASE_NAME_LINUX }}"
path: "${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_LINUX }}"
retention-days: 5

build_and_release_macos:
name: Build and Release MacOS

runs-on: macos-latest

env:
RELEASE_NAME_MACOS: "${{ github.event.repository.name }}-${{ github.ref_name }}-MacOS"
OUTPUT_DIR: "./target/aarch64-apple-darwin/release"

steps:
- uses: actions/checkout@v3 # Same as with Windows

# Install required target for MacOS
- name: Install required target
run: rustup target add aarch64-apple-darwin

- name: Build Release # Same as with Windows
run: cargo build --verbose --release --target=aarch64-apple-darwin # We need to specify the target for MacOS

- name: Rename Artifact # Same as with Windows
run: mv ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_NAME }} ${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_MACOS }}

- name: Add Artifact To Github Release # Same as with Windows
uses: ncipollo/release-action@v1
with:
artifacts: "${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_MACOS }}"
replacesArtifacts: false
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
generateReleaseNotes: true
draft: true
prerelease: true
artifactErrorsFailBuild: true
updateOnlyUnreleased: true

- name: Add Artifact To Action Job # Same as with Windows
uses: actions/upload-artifact@v3
with:
name: "${{ env.RELEASE_NAME_MACOS }}"
path: "${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_MACOS }}"
retention-days: 5

release:
name: Release

# Depends on the build jobs
needs: [build_and_release_windows, build_and_release_linux, build_and_release_macos]

runs-on: ubuntu-latest

steps:
- name: Release Github Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
makeLatest: false # Prevent the release from being marked as latest
updateOnlyUnreleased: true
draft: false # The release is no longer a draft
prerelease: true
generateReleaseNotes: true
retention-days: 5
119 changes: 2 additions & 117 deletions .github/workflows/release-on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }} # The token to use to authenticate with Github
allowUpdates: true # Allow the release to be updated
generateReleaseNotes: true # Generate release notes from the commits
draft: true # If the release should be a draft
draft: false # If the release should be a draft
makeLatest: true # If the release should be marked as the latest release
artifactErrorsFailBuild: true # If the build should fail if the artifact cannot be added to the release
updateOnlyUnreleased: true # If the build should fail if the release is not a draft or pre-release

Expand All @@ -64,119 +65,3 @@ jobs:
name: "${{ env.RELEASE_NAME_WIN }}.exe"
path: "${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_WIN }}.exe"
retention-days: 5

build_and_release_linux:
name: Build and Release Linux

runs-on: ubuntu-latest

env:
RELEASE_NAME_LINUX: "${{ github.event.repository.name }}-${{ github.ref_name }}-Linux"
OUTPUT_DIR: "./target/release"

steps:
- uses: actions/checkout@v3 # Same as with Windows

# Install required tools for Linux
- name: Install required tools
run: sudo apt install libdbus-1-dev pkg-config libudev-dev

# Replace version in cargo.toml
- name: Set Cargo Version
# Assign to variable 'version' in Cargo.toml the version without the prefix 'v'
run: |
version=$(echo $GITHUB_REF | sed 's/refs\/tags\///g' | sed 's/v//g')
sed -i "s/version = \"0.0.0\"/version = \"$version\"/g" Cargo.toml
- name: Build Release # Same as with Windows
run: cargo build --release

- name: Rename Artifact # Same as with Windows
run: mv ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_NAME }} ${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_LINUX }}

- name: Add Artifact To Github Release # Same as with Windows
uses: ncipollo/release-action@v1
with:
artifacts: "${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_LINUX }}"
replacesArtifacts: false
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
generateReleaseNotes: true
draft: true
artifactErrorsFailBuild: true
updateOnlyUnreleased: true

- name: Add Artifact To Action Job # Same as with Windows
uses: actions/upload-artifact@v3
with:
name: "${{ env.RELEASE_NAME_LINUX }}"
path: "${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_LINUX }}"
retention-days: 5

build_and_release_macos:
name: Build and Release MacOS

runs-on: macos-latest

env:
RELEASE_NAME_MACOS: "${{ github.event.repository.name }}-${{ github.ref_name }}-MacOS"
OUTPUT_DIR: "./target/aarch64-apple-darwin/release"

steps:
- uses: actions/checkout@v3 # Same as with Windows

# Replace version in cargo.toml
- name: Set Cargo Version
# Assign to variable 'version' in Cargo.toml the version without the prefix 'v'
# Use MacOS commands
run: |
version=$(echo $GITHUB_REF | sed 's/refs\/tags\///g' | sed 's/v//g')
sed -i '' "s/version = \"0.0.0\"/version = \"$version\"/g" Cargo.toml
# Install required target for MacOS
- name: Install required target
run: rustup target add aarch64-apple-darwin

- name: Build Release # Same as with Windows
run: cargo build --verbose --release --target=aarch64-apple-darwin # We need to specify the target for MacOS

- name: Rename Artifact # Same as with Windows
run: mv ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_NAME }} ${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_MACOS }}

- name: Add Artifact To Github Release # Same as with Windows
uses: ncipollo/release-action@v1
with:
artifacts: "${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_MACOS }}"
replacesArtifacts: false
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
generateReleaseNotes: true
draft: true
artifactErrorsFailBuild: true
updateOnlyUnreleased: true

- name: Add Artifact To Action Job # Same as with Windows
uses: actions/upload-artifact@v3
with:
name: "${{ env.RELEASE_NAME_MACOS }}"
path: "${{ env.OUTPUT_DIR }}/${{ env.RELEASE_NAME_MACOS }}"
retention-days: 5

release:
name: Release

# Depends on the build jobs
needs: [build_and_release_windows, build_and_release_linux, build_and_release_macos]

runs-on: ubuntu-latest

steps:
- name: Release Github Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
makeLatest: true
updateOnlyUnreleased: true
draft: false # The release is no longer a draft
generateReleaseNotes: true

0 comments on commit b1b33dc

Please sign in to comment.