version tagging
This commit is contained in:
parent
e75941094f
commit
1f1d07644f
6 changed files with 41 additions and 59 deletions
|
|
@ -17,16 +17,12 @@ jobs:
|
|||
NIXOS_BUILER_USER: runner
|
||||
PROXMOX_HOST: 192.168.1.205
|
||||
PROXMOX_USER: plasmagoat
|
||||
|
||||
# VM Template IDs for your Ansible playbook
|
||||
# These are now passed to the playbook via --extra-vars, not directly as env vars for qm.
|
||||
# They are defined in group_vars/all.yml, but can be overridden from here if needed.
|
||||
# TEMPLATE_VMID: 9001 # Removed from direct env for explicit passing to Ansible
|
||||
# LATEST_TEMPLATE_VMID: 9000 # Removed from direct env for explicit passing to Ansible
|
||||
outputs:
|
||||
image-name: ${{ steps.build_image.outputs.image_name_from_build }}
|
||||
flake-metadata: ${{ steps.meta.outputs.metadata }}
|
||||
image-version: ${{ steps.version.outputs.tag_name }}
|
||||
image-url: ${{ steps.image-artifact.outputs.artifact-url }}
|
||||
flake-metadata: ${{ steps.meta.outputs.metadata }}
|
||||
|
||||
steps:
|
||||
# Use nix-env for setup (as you prefer and it works well for ephemeral environments)
|
||||
- name: Install dependencies via nix-env
|
||||
|
|
@ -89,26 +85,31 @@ jobs:
|
|||
echo "image_path_from_build=${IMAGE_PATH}" >> "$GITHUB_OUTPUT"
|
||||
echo "image_name_from_build=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set version
|
||||
id: version
|
||||
run: |
|
||||
if [[ "${{ github.ref_type }}" == "tag" ]]; then
|
||||
TAG_NAME="${{ github.ref_name }}"
|
||||
else
|
||||
TAG_NAME="dev-$(date +%Y%m%d)-${GITHUB_SHA::7}"
|
||||
fi
|
||||
echo "Ref Type: ${{ github.ref_type }}"
|
||||
echo "Ref Name: ${{ github.ref_name }}"
|
||||
echo "Version: $TAG_NAME"
|
||||
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Run Proxmox Image Deployment
|
||||
run: |
|
||||
chmod +x ./scripts/run_ansible_ci.sh
|
||||
# Execute the script, passing necessary environment variables
|
||||
bash scripts/run_ansible_ci.sh
|
||||
env:
|
||||
# These are passed directly to the `run_ansible_ci.sh` script,
|
||||
# which then uses them to construct Ansible's --extra-vars.
|
||||
# Match these variable names with what `run_ansible_ci.sh` expects.
|
||||
# Note: The `image_path_from_build` comes from the previous step's output.
|
||||
PROXMOX_LOCAL_IMAGE_PATH_FROM_BUILD: ${{ steps.build_image.outputs.image_path_from_build }}
|
||||
|
||||
# Provide VMIDs and names, overriding group_vars if desired.
|
||||
# These will be passed as `--extra-vars` to Ansible.
|
||||
ANSIBLE_EXTRA_VARS: >-
|
||||
backup_template_vmid={{ env.TEMPLATE_VMID | default('9001') }}
|
||||
latest_template_vmid={{ env.LATEST_TEMPLATE_VMID | default('9000') }}
|
||||
proxmox_host={{ env.PROXMOX_HOST }}
|
||||
proxmox_user={{ env.PROXMOX_USER }}
|
||||
remote_image_path_ci={{ steps.build_image.outputs.image_path_from_build }}
|
||||
version={{ steps.version.outputs.tag_name }}
|
||||
|
||||
- name: Extract flake metadata
|
||||
id: meta
|
||||
|
|
@ -153,25 +154,12 @@ jobs:
|
|||
with:
|
||||
name: release-artifact
|
||||
|
||||
- name: Set version
|
||||
id: version
|
||||
run: |
|
||||
if [[ "${{ github.ref_type }}" == "tag" ]]; then
|
||||
TAG_NAME="${{ github.ref_name }}"
|
||||
else
|
||||
TAG_NAME="dev-$(date +%Y%m%d)-${GITHUB_SHA::7}"
|
||||
fi
|
||||
echo "Ref Type: ${{ github.ref_type }}"
|
||||
echo "Ref Name: ${{ github.ref_name }}"
|
||||
echo "Version: $TAG_NAME"
|
||||
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Create Forgejo Release
|
||||
uses: https://code.forgejo.org/sheik/forgejo-release@v2.6.0
|
||||
with:
|
||||
title: "NixOS Base Image ${{ steps.version.outputs.tag_name }}"
|
||||
title: "NixOS Base Image ${{ needs.build.outputs.image-version }}"
|
||||
prerelease: ${{ github.ref_type != 'tag' }}
|
||||
tag: ${{ steps.version.outputs.tag_name }}
|
||||
tag: ${{ needs.build.outputs.image-version }}
|
||||
direction: upload
|
||||
release-notes: |
|
||||
✅ **Base NixOS image uploaded**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue