From ef743ecf5e92d56e7cd50148afd6b546143af9f4 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Mon, 29 Apr 2024 13:44:50 -0400 Subject: [PATCH] [Snap] Rename .snapcraft.yaml -> snapcraft.yaml --- .../workflows/generate_snap_stable_config.yml | 21 ++++++++++++------- .snapcraft.yaml => snapcraft.yaml | 0 2 files changed, 14 insertions(+), 7 deletions(-) rename .snapcraft.yaml => snapcraft.yaml (100%) diff --git a/.github/workflows/generate_snap_stable_config.yml b/.github/workflows/generate_snap_stable_config.yml index ff145aea2c5..8e0e493f53b 100644 --- a/.github/workflows/generate_snap_stable_config.yml +++ b/.github/workflows/generate_snap_stable_config.yml @@ -11,7 +11,7 @@ on: paths: # Path filters are not evaluated for pushes to tags. - '.github/workflows/generate_snap_stable_config.yml' - '.ci/snap/**' - - '.snapcraft.yaml' + - 'snapcraft.yaml' - 'pkg/snap/**' # Sequence of patterns matched against refs/tags tags: @@ -20,7 +20,7 @@ on: paths: - '.github/workflows/generate_snap_stable_config.yml' - '.ci/snap/**' - - '.snapcraft.yaml' + - 'snapcraft.yaml' - 'pkg/snap/**' release: types: @@ -98,12 +98,12 @@ jobs: path: snap-stable-build - name: Generate Snap Stable Config run: | - BASE_SNAPCRAFT_YAML=".snapcraft.yaml" + BASE_SNAPCRAFT_YAML="snapcraft.yaml" SNAPCRAFT_STABLE_OVERRIDES_YAML=".ci/snap/snapcraft-stable-overrides.yaml" # Verify that required files / folders exist in main repo cd "${GITHUB_WORKSPACE}/warzone2100" if [[ ! -f "${BASE_SNAPCRAFT_YAML}" ]]; then - echo "Missing expected .snapcraft.yaml in warzone2100 repo" + echo "Missing expected snapcraft.yaml in warzone2100 repo" exit 1 fi if [ ! -d "pkg/snap" ]; then @@ -111,8 +111,15 @@ jobs: exit 1 fi + # Remove the old .snapcraft.yaml (note: has a "." prefix) + OLD_DOT_PREFIX_SNAPCRAFT_YAML_PATH="${GITHUB_WORKSPACE}/snap-stable-build/.snapcraft.yaml" + if [ -f "${OLD_DOT_PREFIX_SNAPCRAFT_YAML_PATH}" ]; then + echo "Removing old .snapcraft.yaml file" + rm "${OLD_DOT_PREFIX_SNAPCRAFT_YAML_PATH}" + fi + # Generate stable repo snapcraft.yml (that uses tags directly) from main repo snapcraft.yml via yq merge - yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' "${BASE_SNAPCRAFT_YAML}" "${SNAPCRAFT_STABLE_OVERRIDES_YAML}" > "${GITHUB_WORKSPACE}/snap-stable-build/.snapcraft.yaml" + yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' "${BASE_SNAPCRAFT_YAML}" "${SNAPCRAFT_STABLE_OVERRIDES_YAML}" > "${GITHUB_WORKSPACE}/snap-stable-build/snapcraft.yaml" # Write .stable_tag file that contains the desired published tag LATEST_GITHUB_RELEASE_TAG=$(cat "${{ steps.preparefolders.outputs.RELEASES_DATA }}/latest.json" | jq --raw-output '.tag_name') @@ -130,7 +137,7 @@ jobs: cp -r pkg/snap/. "${GITHUB_WORKSPACE}/snap-stable-build/pkg/snap" - name: Debug output generated config run: | - cat "${GITHUB_WORKSPACE}/snap-stable-build/.snapcraft.yaml" + cat "${GITHUB_WORKSPACE}/snap-stable-build/snapcraft.yaml" - name: Commit changes to snap-stable-build id: commit-snap-changes working-directory: "${{ github.workspace }}/snap-stable-build" @@ -214,7 +221,7 @@ jobs: git am -k "${{ github.workspace }}/diff/snapstablebuild.diff" - name: Debug output generated config run: | - cat "${GITHUB_WORKSPACE}/snap-stable-build/.snapcraft.yaml" + cat "${GITHUB_WORKSPACE}/snap-stable-build/snapcraft.yaml" - name: Push config to snap-stable-build if: success() && (github.repository == 'Warzone2100/warzone2100') id: push-snap-changes diff --git a/.snapcraft.yaml b/snapcraft.yaml similarity index 100% rename from .snapcraft.yaml rename to snapcraft.yaml