Skip to content

Fix release workflow #45

Fix release workflow

Fix release workflow #45

name: Build and Release
on:
push:
jobs:
test:
strategy:
matrix:
os:
- name: x86_64-pc-windows-msvc
runner: windows-latest
- name: x86_64-apple-darwin
runner: macos-13
- name: aarch64-apple-darwin
runner: macos-latest
- name: x86_64-unknown-linux-gnu
runner: ubuntu-latest
- name: aarch64-unknown-linux-gnu
runner: ubuntu-latest
runs-on: ${{ matrix.os.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Run Tests
run: deno test -A
build:
strategy:
matrix:
os:
- name: x86_64-pc-windows-msvc
runner: windows-latest
- name: x86_64-apple-darwin
runner: macos-13
- name: aarch64-apple-darwin
runner: macos-latest
- name: x86_64-unknown-linux-gnu
runner: ubuntu-latest
- name: aarch64-unknown-linux-gnu
runner: ubuntu-latest
runs-on: ${{ matrix.os.runner }}
needs:
- test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Build
run: deno compile -A --output=builds/ --target=${{ matrix.os.name }} main.ts
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os.name }}
path: ${{ startsWith(matrix.os.runner, 'windows') && 'builds/drenv.exe' || 'builds/drenv' }}
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
needs:
- build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: builds
- name: List files
run: ls -lahR builds
- name: Reorganize files
run: |
mv builds/x86_64-pc-windows-msvc/drenv.exe builds/x86_64-pc-windows-msvc.drenv.exe
mv builds/x86_64-apple-darwin/drenv builds/x86_64-apple-darwin.drenv
mv builds/aarch64-apple-darwin/drenv builds/aarch64-apple-darwin.drenv
mv builds/x86_64-unknown-linux-gnu/drenv builds/x86_64-unknown-linux-gnu.drenv
mv builds/aarch64-unknown-linux-gnu/drenv builds/aarch64-unknown-linux-gnu.drenv
- name: List files
run: ls -lahR builds
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: builds/*
fail_on_unmatched_files: true
generate_release_notes: true