Skip to content

release-nightly

release-nightly #1334

name: release-nightly
on:
workflow_dispatch:
schedule:
- cron: "45 0 * * *"
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
permissions:
contents: write
packages: write
id-token: write
attestations: write
jobs:
# Check if the actions already ran in the last 24 hours
# * If yes: Don't run again
# * If no: Clean out existing release assets
prepare-nightly:
runs-on: ubuntu-latest
name: Prepare Nightly Release
outputs:
should-run: ${{ steps.should-run.outputs.should-run }}
# TODO: Re-add
# if: ${{ github.repository == 'gleam-lang/gleam' }}
steps:
- uses: actions/checkout@v6
- name: print latest_commit
run: echo ${{ github.sha }}
- id: should-run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "should-run=false" >> $GITHUB_OUTPUT
- name: Delete old release assets
uses: mknejp/delete-release-assets@v1
if: ${{ steps.should-run != 'false' }}
with:
token: ${{ github.token }}
tag: nightly
fail-if-no-assets: false
fail-if-no-release: false
assets: |
*.zip
*.tar.gz
*.sha256
*.sha512
*.sigstore
*.sbom.*.json
build-release:
name: build-release
runs-on: ${{ matrix.os }}
environment: release
outputs:
release-id: ${{ steps.release.outputs.id }}
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- x86_64-apple-darwin
- aarch64-apple-darwin
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc
toolchain: [ stable ]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
expected-binary-architecture: x86-64
cargo-tool: cross
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
expected-binary-architecture: aarch64
cargo-tool: cross
# macos>=14 runs exclusively on aarch64 and will thus fail to execute properly for x64
- os: macos-13
target: x86_64-apple-darwin
expected-binary-architecture: x86_64
cargo-tool: cargo
- os: macos-latest
target: aarch64-apple-darwin
expected-binary-architecture: arm64
cargo-tool: cargo
- os: windows-2022
target: x86_64-pc-windows-msvc
expected-binary-architecture: x86-64
cargo-tool: cargo
- os: windows-11-arm
target: aarch64-pc-windows-msvc
expected-binary-architecture: arm64
cargo-tool: cargo
- os: ubuntu-latest
target: wasm32-unknown-unknown
cargo-tool: wasm-pack
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Update versions
shell: bash
run: ./bin/add-nightly-suffix-to-versions.sh
- name: "Build Archive"
id: build
uses: "./.github/actions/build-release"
with:
version: nightly
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
cargo-tool: ${{ matrix.cargo-tool }}
expected-binary-architecture: ${{ matrix.expected-binary-architecture }}
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-trusted-signing-account-name: ${{ vars.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
azure-certificate-profile-name: ${{ vars.AZURE_CERTIFICATE_PROFILE_NAME }}
- name: Upload release archive
id: release
# https://github.com/softprops/action-gh-release/issues/445
# uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@f2352b97da0095b4dbbd885a81023e3deabf4fef
with:
draft: false
prerelease: true
fail_on_unmatched_files: true
files: "${{ steps.build.outputs.files }}"
tag_name: nightly
name: "Nightly"
body: |
A build that runs every night following changes to the main branch. Contains all the latest features and changes, but there is a higher chance of instability, bugs, and unfinished features.
The assets are updated but the tag is not, so if you view the commit or download the source from below you will not get the correct code.
build-container-images:
name: build-container-images
needs: [ prepare-nightly, build-release ]
runs-on: ubuntu-latest
if: ${{ needs.prepare-nightly.outputs.should-run != 'false' }}
strategy:
matrix:
base-image:
- scratch
- erlang
- erlang-slim
- erlang-alpine
- elixir
- elixir-slim
- elixir-alpine
- node
- node-slim
- node-alpine
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
sparse-checkout: |
.github/actions
containers
- name: "Build & Push Container"
uses: "./.github/actions/build-container"
with:
version: nightly
release-id: ${{ needs.build-release.outputs.release-id }}