Skip to content

Update: Fixed minor matching on semver. Now support watch on macOS #230

Update: Fixed minor matching on semver. Now support watch on macOS

Update: Fixed minor matching on semver. Now support watch on macOS #230

Workflow file for this run

name: Update release and nightly
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
os_name: linux
arch: x86_64
- os: ubuntu-24.04-arm
os_name: linux
arch: arm64
- os: macos-latest
os_name: osx
arch: arm64
- os: windows-latest
os_name: windows
arch: x86_64
- os: windows-latest
os_name: windows
arch: arm64
fail-fast: false
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- uses: MrcSnm/setup-dlang@v2
with:
compiler: ldc-latest
redub: master
- name: Build
if: runner.os != 'macOS'
run: |
redub build -b release-debug --prefetch
- name: Build (OSX Universal)
if: runner.os == 'macOS'
run: |
# Build arm64 version
redub build -b release-debug --prefetch --arch=arm64-apple-darwin
mv build/redub build/redub-arm64
# Build x86_64 version
redub build -b release-debug --prefetch --arch=x86_64
mv build/redub build/redub-x86_64
lipo -create build/redub-arm64 build/redub-x86_64 -output build/redub
rm build/redub-arm64 build/redub-x86_64
- name: Rename artifact on Windows
if: runner.os == 'Windows'
run: |
dir
move build/redub.exe redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-windows-${{ matrix.arch }}.exe
- name: Upload artifacts on Windows
uses: actions/upload-artifact@v4
if: runner.os == 'Windows'
with:
name: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-windows-${{ matrix.arch }}.exe
path: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-windows-${{ matrix.arch }}.exe
- name: Rename artifact on macOS
if: runner.os == 'macOS'
run: |
ls -R
mv build/redub redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-${{ matrix.os_name }}-universal
- name: Upload artifacts on macOS
uses: actions/upload-artifact@v4
if: runner.os == 'macOS'
with:
name: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-${{ matrix.os_name }}-universal
path: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-${{ matrix.os_name }}-universal
- name: Rename artifact on Linux
if: runner.os == 'Linux'
run: |
ls -R
mv build/redub redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-${{ matrix.os_name }}-${{ matrix.arch }}
- name: Upload artifacts on Linux
uses: actions/upload-artifact@v4
if: runner.os == 'Linux'
with:
name: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-${{ matrix.os_name }}-${{ matrix.arch }}
path: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-${{ matrix.os_name }}-${{ matrix.arch }}
# freebsd:
# strategy:
# matrix:
# arch: [x86_64]
# fail-fast: false
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Run FreeBSD VM
# uses: vmactions/freebsd-vm@v1
# with:
# usesh: true
# prepare: |
# pkg install -y dub ldc
# run: |
# dub build -b release
# - uses: actions/upload-artifact@v4
# if: github.ref == 'refs/heads/main'
# with:
# name: redub-freebsd-14.2-x86_64
# path: build
# alpine:
# strategy:
# matrix:
# arch: [x86_64]
# fail-fast: false
# runs-on: ubuntu-latest
# container:
# image: alpine:latest
# defaults:
# run:
# shell: sh
# steps:
# - uses: actions/checkout@v4
# - uses: MrcSnm/setup-dlang@v2
# with:
# compiler: ldc-latest
# redub: 1.25.2
# - name: Build
# run: |
# redub build -b release-debug
# - run: mv build/redub redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-alpine-${{ matrix.arch }}
# - uses: actions/upload-artifact@v4
# with:
# name: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-alpine-${{ matrix.arch }}
# path: redub-${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}-alpine-${{ matrix.arch }}
update-release:
runs-on: ubuntu-latest
# needs: [build, alpine]
needs: [build]
permissions:
contents: write
steps:
- name: "Download build artifacts"
uses: actions/download-artifact@v4.1.8
with:
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R
- uses: actions/checkout@v4
with:
path: repository
fetch-depth: 0
fetch-tags: true
- name: Get latest tag for nightly
if: startsWith(github.ref, 'refs/heads/main')
run: |
cd repository
latest=$(git describe --tags --abbrev=0)
echo "latest_tag=$latest" >> $GITHUB_ENV
- name: Get latest tag for release
if: startsWith(github.ref, 'refs/tags/')
run: |
cd repository
latest=$(git describe --tags --abbrev=0 $GITHUB_REF_NAME^)
echo "latest_tag=$latest" >> $GITHUB_ENV
- name: Generate changelog
run: |
cd repository
echo "Describe from ${{ env.latest_tag }} to HEAD"
git log --oneline ${{ env.latest_tag }}..HEAD > ../release_notes.txt
- name: Publish release
uses: ncipollo/release-action@v1
with:
artifacts: "redub-*"
allowUpdates: "true"
tag: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'nightly' }}
name: ${{ startsWith(github.ref, 'refs/tags/') && format('Redub {0}', github.ref_name) || 'Redub Nightly' }}
prerelease: ${{ startsWith(github.ref, 'refs/tags/') && 'false' || 'true' }}
bodyFile: release_notes.txt