Current section

Files

Jump to
tinfoil priv templates release.yml.eex
Raw

priv/templates/release.yml.eex

# Generated by tinfoil <%= @tinfoil_version %>. Do not edit by hand.
# Regenerate with: mix tinfoil.generate
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write<%= if @attestations do %>
id-token: write
attestations: write<% end %>
env:
MIX_ENV: prod
APP_NAME: <%= @app %>
jobs:
build:
name: Build ${{ matrix.id }}
strategy:
fail-fast: false
matrix:
include:<%= for entry <- @build_entries do %>
- id: <%= entry.id %>
targets: "<%= entry.targets %>"
runner: <%= entry.runner %><% end %>
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Elixir/OTP
uses: erlef/setup-beam@v1
with:
elixir-version: "<%= @ci.elixir_version %>"
otp-version: "<%= @ci.otp_version %>"
- name: Set up Zig
uses: mlugg/setup-zig@v2
with:
version: "<%= @ci.zig_version %>"
- name: Cache mix deps and build
uses: actions/cache@v5
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ matrix.id }}-mix-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.id }}-mix-
- name: Install dependencies
run: mix deps.get
- name: Build and package release
run: |
for target in $(echo "${{ matrix.targets }}" | tr ',' ' '); do
mix tinfoil.build --target "$target"
done
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: binary-${{ matrix.id }}
path: _tinfoil/*
if-no-files-found: error
<%= if @attestations do %>
- name: Attest build provenance
uses: actions/attest-build-provenance@v2
with:
subject-path: _tinfoil/*.tar.gz, _tinfoil/*.zip
<% end %>
release:
name: Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Elixir/OTP
uses: erlef/setup-beam@v1
with:
elixir-version: "<%= @ci.elixir_version %>"
otp-version: "<%= @ci.otp_version %>"
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
- name: Cache mix deps and build
uses: actions/cache@v5
with:
path: |
deps
_build
key: ${{ runner.os }}-release-mix-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-release-mix-
- name: Install dependencies
run: mix deps.get
- name: Publish GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mix tinfoil.publish --input-dir artifacts<%= if @github.draft do %> --draft<% end %>
<%= if @homebrew.enabled do %>
homebrew:
name: Update Homebrew tap
needs: release
runs-on: ubuntu-latest
if: ${{ !contains(github.ref_name, '-rc') && !contains(github.ref_name, '-beta') && !contains(github.ref_name, '-alpha') }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Elixir/OTP
uses: erlef/setup-beam@v1
with:
elixir-version: "<%= @ci.elixir_version %>"
otp-version: "<%= @ci.otp_version %>"
- name: Install dependencies
run: mix deps.get
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
<%= if @homebrew.auth == :deploy_key do %>
- name: Set up SSH deploy key
uses: webfactory/ssh-agent@v0.10.0
with:
ssh-private-key: ${{ secrets.<%= @homebrew.deploy_key_secret %> }}
<% end %>
- name: Update Homebrew formula<%= if @homebrew.auth == :token do %>
env:
HOMEBREW_TAP_TOKEN: ${{ secrets.<%= @homebrew.token_secret %> }}<% end %>
run: mix tinfoil.homebrew --input-dir artifacts
<% end %>
<%= if @scoop.enabled do %>
scoop:
name: Update Scoop bucket
needs: release
runs-on: ubuntu-latest
if: ${{ !contains(github.ref_name, '-rc') && !contains(github.ref_name, '-beta') && !contains(github.ref_name, '-alpha') }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Elixir/OTP
uses: erlef/setup-beam@v1
with:
elixir-version: "<%= @ci.elixir_version %>"
otp-version: "<%= @ci.otp_version %>"
- name: Install dependencies
run: mix deps.get
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
<%= if @scoop.auth == :deploy_key do %>
- name: Set up SSH deploy key
uses: webfactory/ssh-agent@v0.10.0
with:
ssh-private-key: ${{ secrets.<%= @scoop.deploy_key_secret %> }}
<% end %>
- name: Update Scoop manifest<%= if @scoop.auth == :token do %>
env:
SCOOP_BUCKET_TOKEN: ${{ secrets.<%= @scoop.token_secret %> }}<% end %>
run: mix tinfoil.scoop --input-dir artifacts
<% end %>