Skip to content

Commit

Permalink
[Snap] Rename .snapcraft.yaml -> snapcraft.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Apr 29, 2024
1 parent 8b184ed commit ef743ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/generate_snap_stable_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -20,7 +20,7 @@ on:
paths:
- '.github/workflows/generate_snap_stable_config.yml'
- '.ci/snap/**'
- '.snapcraft.yaml'
- 'snapcraft.yaml'
- 'pkg/snap/**'
release:
types:
Expand Down Expand Up @@ -98,21 +98,28 @@ 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
echo "Missing expected pkg/snap folder in warzone2100 repo"
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')
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down
File renamed without changes.

0 comments on commit ef743ec

Please sign in to comment.