diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b1b0900..0dd05b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,35 +52,34 @@ jobs: - name: Create a new GitHub Release run: | # Create a new GitHub Release if it does not exists - gh release list | grep "v${DEBIAN_VERSION}-${DEBIAN_RELEASE}" || - gh release create "v${DEBIAN_VERSION}-${DEBIAN_RELEASE}" \ + gh release list | grep "${GITHUB_RELEASE}" || + gh release create "${GITHUB_RELEASE}" \ --repo="${GITHUB_REPOSITORY}" \ - --title="v${DEBIAN_VERSION}-${DEBIAN_RELEASE}" \ + --title="${GITHUB_RELEASE}" \ --latest \ --draft + customize: + name: Customize image + needs: download + runs-on: ubuntu-latest - # customize: - # name: Customize image - # needs: download - # runs-on: ubuntu-latest - - # strategy: - # matrix: - # variant: [qemu, locales, extras] + strategy: + matrix: + variant: [qemu, locales, extras] - # steps: - # - name: Checkout - # uses: actions/checkout@v4 + steps: + - name: Checkout + uses: actions/checkout@v4 - # - name: Load settings - # run: source settings.sh + - name: Load settings + run: source settings.sh ${{ matrix.variant }} - # - name: Load cached files - # uses: actions/cache@v4 - # with: - # key: ${{ env.GIT_CACHE_NAME }} - # path: ${{ env.IMAGE_FILENAME }} + - name: Load cached files + uses: actions/cache@v4 + with: + key: ${{ env.GIT_CACHE_NAME }} + path: ${{ env.IMAGE_FILENAME }} # - name: Install libguestfs # run: sudo apt-get install -y libguestfs-tools diff --git a/settings.sh b/settings.sh index 834666d..b78110e 100644 --- a/settings.sh +++ b/settings.sh @@ -11,14 +11,17 @@ DEBIAN_FILEURL="$DEBIAN_BASEURL/$DEBIAN_VERNAME/$DEBIAN_RELEASE/debian-${DEBIAN_ # Image filename IMAGE_FILENAME=$(basename $DEBIAN_FILEURL) -# Release name +# GitHub cache +GIT_CACHE_NAME="debian-$DEBIAN_VERSION-$DEBIAN_VARIANT-$DEBIAN_RELEASE" + +# GitHub release name if [[ "${GITHUB_REF_NAME}" == "refs/tags/*" ]]; then GITHUB_RELEASE="${GITHUB_REF_NAME}" else GITHUB_RELEASE="v${DEBIAN_VERSION}-${DEBIAN_RELEASE}" fi -echo ">>> $GITHUB_RELEASE" +echo ">>> $1" # packages=( # [qemu]=qemu-guest-agent @@ -30,8 +33,6 @@ echo ">>> $GITHUB_RELEASE" # IMAGE_REF_NAME="v${DEBIAN_VERSION}-${DEBIAN_RELEASE}" -# Github cache -GIT_CACHE_NAME="debian-$DEBIAN_VERSION-$DEBIAN_VARIANT-$DEBIAN_RELEASE" # Export variables to github workflow if [[ -f "$GITHUB_ENV" ]]; then @@ -43,5 +44,6 @@ cat >> "$GITHUB_ENV" <<-EOF DEBIAN_FILEURL=$DEBIAN_FILEURL IMAGE_FILENAME=$IMAGE_FILENAME GIT_CACHE_NAME=$GIT_CACHE_NAME + GITHUB_RELEASE=$GITHUB_RELEASE EOF fi