Skip to content

Update:

Update: #163

Workflow file for this run

name: Update release and nightly
on:
pull_request:
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: latest
- name: Build
run: |
redub build -b release-debug --prefetch
- 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 Unix
if: runner.os != 'Windows'
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 Unix
uses: actions/upload-artifact@v4
if: runner.os != 'Windows'
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
- name: Prepare
run: |
apk update
apk add --no-cache ldc dub clang
- name: Build
run: |
dub 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]
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