1 Commits

Author SHA1 Message Date
c5e2854f27 WIP
All checks were successful
run tests / check (push) Successful in 25s
run tests / release (push) Successful in 15s
2025-12-09 10:05:35 +01:00
8 changed files with 21 additions and 73 deletions

View File

@@ -28,6 +28,13 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./declare
with:
configure_runner_environment: false
filename: ./src/release/tests/assets/release.yaml
- run: set -u; echo "$RELEASE_PROJECT_CURRENT_VERSION"
# skip login locally # skip login locally
- if: github.repository == 'actions/release' - if: github.repository == 'actions/release'
uses: https://gitea.puzzleyou.net/actions/configure-runner-environment@master uses: https://gitea.puzzleyou.net/actions/configure-runner-environment@master
@@ -35,9 +42,6 @@ jobs:
- uses: ./release - uses: ./release
with: with:
dry_run: true dry_run: true
configure_runner_environment: false
- run: set -u; echo "$RELEASE_PROJECT_CURRENT_VERSION"
test-declare-directly: test-declare-directly:
runs-on: action-runner runs-on: action-runner

View File

@@ -14,4 +14,5 @@ jobs:
runs-on: action-runner runs-on: action-runner
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./declare # TODO single action
- uses: ./release - uses: ./release

View File

@@ -46,7 +46,7 @@ runs:
steps: steps:
- name: add artefact - name: add artefact
run: | run: |
nix run ${{ github.action_path }} -- \ nix run . -- \
add-artefact \ add-artefact \
--state "${RELEASE_ACTION_STATEFILE}" \ --state "${RELEASE_ACTION_STATEFILE}" \
--artefact-type "${{ inputs.type }}" \ --artefact-type "${{ inputs.type }}" \

View File

@@ -38,7 +38,7 @@ runs:
steps: steps:
- name: add deployment - name: add deployment
run: | run: |
nix run ${{ github.action_path }} -- \ nix run . -- \
add-deployment \ add-deployment \
--state "${RELEASE_ACTION_STATEFILE}" \ --state "${RELEASE_ACTION_STATEFILE}" \
--deployment-type "${{ inputs.type }}" \ --deployment-type "${{ inputs.type }}" \

View File

@@ -104,11 +104,6 @@ runs:
- name: init action state - name: init action state
run: | run: |
if [[ ! -z "${RELEASE_PROJECT_CURRENT_VERSION}" ]]; then
echo "already set up."
exit 0
fi
RELEASE_ACTION_STATEFILE=$(mktemp) RELEASE_ACTION_STATEFILE=$(mktemp)
echo "[release] statefile: $RELEASE_ACTION_STATEFILE" echo "[release] statefile: $RELEASE_ACTION_STATEFILE"
echo "RELEASE_ACTION_STATEFILE="$RELEASE_ACTION_STATEFILE"" \ echo "RELEASE_ACTION_STATEFILE="$RELEASE_ACTION_STATEFILE"" \
@@ -117,18 +112,13 @@ runs:
- name: declare release project - name: declare release project
if: inputs.version_descriptor == '' if: inputs.version_descriptor == ''
run: | run: |
if [[ ! -z "${RELEASE_PROJECT_CURRENT_VERSION}" ]]; then
echo "already set up."
exit 0
fi
if [[ "${{ github.ref_name }}" == "master" || "${{ github.ref_name }}" == "main" ]]; then if [[ "${{ github.ref_name }}" == "master" || "${{ github.ref_name }}" == "main" ]]; then
IS_PRE_RELEASE="0" IS_PRE_RELEASE="0"
else else
IS_PRE_RELEASE="1" IS_PRE_RELEASE="1"
fi fi
nix run ${{ github.action_path }} -- \ nix run . -- \
declare \ declare \
--state "${RELEASE_ACTION_STATEFILE}" \ --state "${RELEASE_ACTION_STATEFILE}" \
--release-yaml-filename "${{ inputs.filename }}" \ --release-yaml-filename "${{ inputs.filename }}" \
@@ -139,7 +129,7 @@ runs:
--release-commit-sha "${{ github.sha }}" \ --release-commit-sha "${{ github.sha }}" \
--is-pre-release "${IS_PRE_RELEASE}" --is-pre-release "${IS_PRE_RELEASE}"
nix run ${{ github.action_path }} -- \ nix run . -- \
dump \ dump \
--state "${RELEASE_ACTION_STATEFILE}" \ --state "${RELEASE_ACTION_STATEFILE}" \
--write-env-vars-to-filename "$GITHUB_ENV" --write-env-vars-to-filename "$GITHUB_ENV"
@@ -147,18 +137,13 @@ runs:
- name: declare release project - name: declare release project
if: inputs.version_descriptor != '' if: inputs.version_descriptor != ''
run: | run: |
if [[ ! -z "${RELEASE_PROJECT_CURRENT_VERSION}" ]]; then
echo "already set up."
exit 0
fi
if [[ "${{ github.ref_name }}" == "master" || "${{ github.ref_name }}" == "main" ]]; then if [[ "${{ github.ref_name }}" == "master" || "${{ github.ref_name }}" == "main" ]]; then
IS_PRE_RELEASE="0" IS_PRE_RELEASE="0"
else else
IS_PRE_RELEASE="1" IS_PRE_RELEASE="1"
fi fi
nix run ${{ github.action_path }} -- \ nix run . -- \
declare \ declare \
--state "${RELEASE_ACTION_STATEFILE}" \ --state "${RELEASE_ACTION_STATEFILE}" \
--version-descriptor "${{ inputs.version_descriptor }}" \ --version-descriptor "${{ inputs.version_descriptor }}" \
@@ -170,7 +155,7 @@ runs:
--is-pre-release "${IS_PRE_RELEASE}" \ --is-pre-release "${IS_PRE_RELEASE}" \
if [[ ! -z "${{ inputs.artefact_type }}" ]]; then if [[ ! -z "${{ inputs.artefact_type }}" ]]; then
nix run ${{ github.action_path }} -- \ nix run . -- \
add-artefact \ add-artefact \
--state "${RELEASE_ACTION_STATEFILE}" \ --state "${RELEASE_ACTION_STATEFILE}" \
--artefact-type "${{ inputs.artefact_type }}" \ --artefact-type "${{ inputs.artefact_type }}" \
@@ -184,7 +169,7 @@ runs:
fi fi
if [[ ! -z "${{ inputs.deployment_type }}" ]]; then if [[ ! -z "${{ inputs.deployment_type }}" ]]; then
nix run ${{ github.action_path }} -- \ nix run . -- \
add-deployment \ add-deployment \
--state "${RELEASE_ACTION_STATEFILE}" \ --state "${RELEASE_ACTION_STATEFILE}" \
--deployment-type "${{ inputs.deployment_type }}" \ --deployment-type "${{ inputs.deployment_type }}" \
@@ -195,7 +180,7 @@ runs:
--deployment-repository "${{ inputs.deployment_repository }}" --deployment-repository "${{ inputs.deployment_repository }}"
fi fi
nix run ${{ github.action_path }} -- \ nix run . -- \
dump \ dump \
--state "${RELEASE_ACTION_STATEFILE}" \ --state "${RELEASE_ACTION_STATEFILE}" \
--write-env-vars-to-filename "$GITHUB_ENV" --write-env-vars-to-filename "$GITHUB_ENV"

View File

@@ -6,6 +6,6 @@ runs:
steps: steps:
- name: dump project description - name: dump project description
run: | run: |
nix run ${{ github.action_path }} -- \ nix run . -- \
dump \ dump \
--state "${RELEASE_ACTION_STATEFILE}" --state "${RELEASE_ACTION_STATEFILE}"

View File

@@ -7,68 +7,26 @@ inputs:
description: "do not change external state" description: "do not change external state"
default: false default: false
configure_runner_environment:
required: false
default: true
runs: runs:
using: composite using: composite
steps: steps:
- if: inputs.configure_runner_environment == 'true'
uses: https://gitea.puzzleyou.net/actions/configure-runner-environment@master
# TODO duplicate code (declare/action.yaml)
- name: declare project if neccessary
run: |
if [[ ! -z "${RELEASE_PROJECT_CURRENT_VERSION}" ]]; then
echo "already set up."
exit 0
fi
RELEASE_ACTION_STATEFILE=$(mktemp)
echo "[release] statefile: $RELEASE_ACTION_STATEFILE"
echo "RELEASE_ACTION_STATEFILE="$RELEASE_ACTION_STATEFILE"" \
>> "$GITHUB_ENV"
if [[ "${{ github.ref_name }}" == "master" || "${{ github.ref_name }}" == "main" ]]; then
IS_PRE_RELEASE="0"
else
IS_PRE_RELEASE="1"
fi
nix run ${{ github.action_path }} -- \
declare \
--state "${RELEASE_ACTION_STATEFILE}" \
--release-yaml-filename ".gitea/release.yaml" \
--gitea-instance "https://gitea.puzzleyou.net" \
--release-repository-name "${{ github.repository }}" \
--release-ref-name "${{ github.ref_name }}" \
--release-run-number "${{ github.run_number }}" \
--release-commit-sha "${{ github.sha }}" \
--is-pre-release "${IS_PRE_RELEASE}"
nix run ${{ github.action_path }} -- \
dump \
--state "${RELEASE_ACTION_STATEFILE}" \
--write-env-vars-to-filename "$GITHUB_ENV"
- name: publish artefacts - name: publish artefacts
run: | run: |
nix run ${{ github.action_path }} -- \ nix run . -- \
publish-artefacts \ publish-artefacts \
--state "${RELEASE_ACTION_STATEFILE}" \ --state "${RELEASE_ACTION_STATEFILE}" \
--dry-run "${{ inputs.dry_run }}" --dry-run "${{ inputs.dry_run }}"
- name: update deployments - name: update deployments
run: | run: |
nix run ${{ github.action_path }} -- \ nix run . -- \
update-deployments \ update-deployments \
--state "${RELEASE_ACTION_STATEFILE}" \ --state "${RELEASE_ACTION_STATEFILE}" \
--dry-run "${{ inputs.dry_run }}" --dry-run "${{ inputs.dry_run }}"
- name: create release - name: create release
run: | run: |
nix run ${{ github.action_path }} -- \ nix run . -- \
create-release \ create-release \
--state "${RELEASE_ACTION_STATEFILE}" \ --state "${RELEASE_ACTION_STATEFILE}" \
--dry-run "${{ inputs.dry_run }}" --dry-run "${{ inputs.dry_run }}"

View File

@@ -63,7 +63,7 @@ def publish_tarball(info: TarballReleaseInfo, cli: Cli):
cli('curl', cli('curl',
'--netrc', '--netrc',
'--fail-with-body', '--fail-with-body',
'--upload-file', info.filename, '--upload-file %s' % info.filename,
'-i', '-i',
'-X', 'PUT', '-X', 'PUT',
'%s/api/packages/puzzleYOU/generic/%s/%s/%s' % ( # TODO owner '%s/api/packages/puzzleYOU/generic/%s/%s/%s' % ( # TODO owner