Compare commits
1 Commits
v0.0.1-dev
...
v0.0.1-dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 27857def4b |
@@ -23,6 +23,32 @@ jobs:
|
|||||||
|
|
||||||
- run: set -u; echo "$RELEASE_PROJECT_CURRENT_VERSION"
|
- run: set -u; echo "$RELEASE_PROJECT_CURRENT_VERSION"
|
||||||
|
|
||||||
|
test-sync-versions:
|
||||||
|
runs-on: action-runner
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# skip login locally
|
||||||
|
- if: github.repository == 'actions/release'
|
||||||
|
uses: https://gitea.puzzleyou.net/actions/configure-runner-environment@master
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
echo "1.33.7" > /tmp/version-test.txt
|
||||||
|
echo "0.0.42" > /tmp/other-version.txt
|
||||||
|
|
||||||
|
- uses: ./declare
|
||||||
|
with:
|
||||||
|
configure_runner_environment: false
|
||||||
|
version_descriptor: /tmp/version-test.txt
|
||||||
|
artefact_type: oci_image
|
||||||
|
artefact_name: default-image
|
||||||
|
artefact_version_descriptor: /tmp/other-version.txt
|
||||||
|
|
||||||
|
- uses: ./sync-versions
|
||||||
|
|
||||||
|
- run: test "$(cat /tmp/version-test.txt)" = "$RELEASE_PROJECT_PLANNED_VERSION"
|
||||||
|
- run: test "$(cat /tmp/other-version.txt)" = "$RELEASE_PROJECT_PLANNED_VERSION"
|
||||||
|
|
||||||
test-is-not-yet-released:
|
test-is-not-yet-released:
|
||||||
runs-on: action-runner
|
runs-on: action-runner
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
6
justfile
6
justfile
@@ -30,5 +30,11 @@ test-workflows:
|
|||||||
--workflows ./.gitea/workflows/check.yaml \
|
--workflows ./.gitea/workflows/check.yaml \
|
||||||
--job test-is-not-yet-released
|
--job test-is-not-yet-released
|
||||||
|
|
||||||
|
act_runner exec \
|
||||||
|
--image "-self-hosted" \
|
||||||
|
--event pull_request \
|
||||||
|
--workflows ./.gitea/workflows/check.yaml \
|
||||||
|
--job test-sync-versions
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
# --image "europe-docker.pkg.dev/puzzle-and-play/docker/action-runner-job:latest" \
|
# --image "europe-docker.pkg.dev/puzzle-and-play/docker/action-runner-job:latest" \
|
||||||
|
|||||||
@@ -11,6 +11,15 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: true
|
default: true
|
||||||
|
|
||||||
|
build_run:
|
||||||
|
required: false
|
||||||
|
description: "commands to run before publishing artefacts"
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
sync_versions:
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
@@ -34,6 +43,17 @@ runs:
|
|||||||
--release-commit-sha "${{ github.sha }}" \
|
--release-commit-sha "${{ github.sha }}" \
|
||||||
--write-env-vars-to-filename "$GITHUB_ENV"
|
--write-env-vars-to-filename "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: sync versions
|
||||||
|
if: inputs.sync_versions == 'true'
|
||||||
|
run: |
|
||||||
|
nix run ${{ github.action_path }} -- \
|
||||||
|
sync-versions \
|
||||||
|
--state "${RELEASE_ACTION_STATEFILE}"
|
||||||
|
|
||||||
|
- name: run build commands
|
||||||
|
if: inputs.build_run != ''
|
||||||
|
run: ${{ inputs.build_run }}
|
||||||
|
|
||||||
- name: publish artefacts
|
- name: publish artefacts
|
||||||
run: |
|
run: |
|
||||||
nix run ${{ github.action_path }} -- \
|
nix run ${{ github.action_path }} -- \
|
||||||
|
|||||||
21
src/main.py
21
src/main.py
@@ -233,14 +233,29 @@ def make_deployment(type: str,
|
|||||||
return DeploymentDescription(deployment=deployment, **maybe_condition)
|
return DeploymentDescription(deployment=deployment, **maybe_condition)
|
||||||
|
|
||||||
|
|
||||||
|
def sync_versions(project_description: ProjectDescription):
|
||||||
|
planned_version = project_description.planned_version
|
||||||
|
|
||||||
|
def sync(descriptor_filename: str):
|
||||||
|
v = versioning.use_any(descriptor_filename)
|
||||||
|
v.version = planned_version
|
||||||
|
v.store()
|
||||||
|
|
||||||
|
sync(project_description.version_descriptor)
|
||||||
|
|
||||||
|
for artefact in project_description.artefacts:
|
||||||
|
if artefact.version_descriptor is not None:
|
||||||
|
sync(artefact.version_descriptor)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
parser.add_argument('action', choices=[
|
parser.add_argument('action', choices=[
|
||||||
# TODO missing: adjust version (development)
|
|
||||||
'declare',
|
'declare',
|
||||||
'check',
|
'check',
|
||||||
'add-artefact',
|
'add-artefact',
|
||||||
'add-deployment',
|
'add-deployment',
|
||||||
|
'sync-versions',
|
||||||
'publish-artefacts',
|
'publish-artefacts',
|
||||||
'update-deployments',
|
'update-deployments',
|
||||||
'create-release',
|
'create-release',
|
||||||
@@ -370,6 +385,10 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
save_project_description(state_file, project_description)
|
save_project_description(state_file, project_description)
|
||||||
|
|
||||||
|
elif args.action == 'sync-versions':
|
||||||
|
project_description = load_project_description(state_file)
|
||||||
|
sync_versions(project_description)
|
||||||
|
|
||||||
elif args.action == 'publish-artefacts':
|
elif args.action == 'publish-artefacts':
|
||||||
project_description = load_project_description(state_file)
|
project_description = load_project_description(state_file)
|
||||||
publish_artefacts(project_description, args.dry_run)
|
publish_artefacts(project_description, args.dry_run)
|
||||||
|
|||||||
13
sync-versions/action.yaml
Normal file
13
sync-versions/action.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
name: "sync version descriptors"
|
||||||
|
description: "update all version descriptors to the planned version."
|
||||||
|
|
||||||
|
inputs: {}
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: sync versions
|
||||||
|
run: |
|
||||||
|
nix run ${{ github.action_path }} -- \
|
||||||
|
sync-versions \
|
||||||
|
--state "${RELEASE_ACTION_STATEFILE}"
|
||||||
Reference in New Issue
Block a user