Add media host #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Media LXC Container | |
# Based on https://freddydumont.com/blog/nixos-github-actions | |
on: | |
workflow_call: | |
pull_request: | |
push: | |
branches: | |
- master | |
tags: | |
- "v*.*.*-*" | |
# The following permissions are required for softprops/action-gh-release@v1. | |
permissions: | |
contents: write | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract tag suffix | |
run: | | |
tag_name="nightly" | |
if [ "$GITHUB_REF_NAME" != "master" ]; then | |
tag_name=$GITHUB_REF_NAME | |
fi | |
echo "TAG_NAME=$tag_name" >> $GITHUB_ENV | |
- name: Install nix | |
uses: cachix/install-nix-action@v24 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate NixOS LXC configuration | |
run: | | |
nix run github:nix-community/nixos-generators -- -f proxmox-lxc --flake .#media | { | |
read path | |
echo "BUILD_PATH=$path" >> $GITHUB_ENV | |
} | |
- name: Modify file name | |
run: | | |
NEW_FILENAME="media-${{ env.TAG_NAME }}-$(basename ${{ env.BUILD_PATH }})" | |
RELEASE_PATH="${{ github.workspace }}/$NEW_FILENAME" | |
cp "${{ env.BUILD_PATH }}" "$RELEASE_PATH" | |
echo "RELEASE_PATH=$RELEASE_PATH" >> $GITHUB_ENV | |
# Create a GitHub release and attach the generated container template. | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
name: ${{ env.TAG_NAME }}-media | |
files: ${{ env.RELEASE_PATH }} | |
prerelease: ${{ env.TAG_NAME == 'nightly' }} | |
tag_name: ${{ env.TAG_NAME }} |