Skip to content

Commit

Permalink
test release artifact generation
Browse files Browse the repository at this point in the history
  • Loading branch information
tothxa committed Nov 7, 2024
1 parent dab0b78 commit a2ab3a3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ jobs:

dev_release:
name: Automated development pre-release
if: ${{ github.repository == 'widelands/widelands' && github.ref == 'refs/heads/master' && always() }}
# NOCOM: allow testing
# if: ${{ github.repository == 'widelands/widelands' && github.ref == 'refs/heads/master' && always() }}
needs: [windows, windows-msvc, macos, appimage]
runs-on: "ubuntu-latest"
steps:
Expand All @@ -141,7 +142,15 @@ jobs:
# artifacts.list lists all attachments of the pre-release. In case a build step failed, we detect
# that a file is missing and download the last successful build from the pre-release.
run: |
RELEASE_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/latest"
# NOCOM: for testing in fork
# RELEASE_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/latest"
RELEASE_URL="$GITHUB_SERVER_URL/widelands/widelands/releases/download/latest"
# NOCOM: debug
echo "Listing job directory:"
ls -l
ls -l Widelands-*
echo "End of directory listing."
# end NOCOM
mkdir Widelands-latest
cd Widelands-latest
curl -L -O "$RELEASE_URL/artifacts.list"
Expand All @@ -152,6 +161,9 @@ jobs:
ls ../Widelands*/Widelands*${MATRIX} || \
curl -L -o $ARTIFACT "$RELEASE_URL/Widelands-daily-${MATRIX}"
done
# NOCOM: debug
echo "Downloaded from previous release:"
ls -l
- name: List and rename artifacts
run: |
sudo apt-get update
Expand All @@ -170,6 +182,11 @@ jobs:
echo "Calculate checksum for \"$ARTIFACT\""
md5sum "${ARTIFACT}" > "${ARTIFACT}.md5"
done
# NOCOM: debug
ls -l
cat artifacts.list
exit 1
# end NOCOM
# curl exits 23 because grep will kill it after the first match
set +e
latest=$(curl -i "https://api.github.com/repos/${GITHUB_REPOSITORY}/commits/master" | grep -m 1 "\"sha\": ")
Expand All @@ -182,10 +199,13 @@ jobs:
exit 1
fi
- name: Updating latest pre-release
# NOCOM: not for testing
if: ${{ github.repository == 'widelands/widelands' && github.ref == 'refs/heads/master' && always() }}
# Creates a new pre-release with the "latest" tag and all gathered artifacts.
# Because all older artifacts are removed, we have to reupload the missing ones detected in the previous step
env:
GH_TOKEN: "${{ secrets.WIDELANDS_FORMAT_TOKEN }}"
# NOCOM: extra safety
#env:
# GH_TOKEN: "${{ secrets.WIDELANDS_FORMAT_TOKEN }}"
run: |
gh release delete latest --yes || echo "No old release to delete"
git push --delete origin latest || echo "No latest tag to delete"
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/build_windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
archname: i686
name: Windows ${{ matrix.config }} ${{ matrix.arch }} Build (MinGW)
runs-on: windows-2022
env:ARTIFACT_NAME = "Widelands-${{ github.sha }}-mingw-${{ matrix.config }}-${{ matrix.arch }}"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -43,11 +44,13 @@ jobs:
if ("${{ matrix.config }}" -Match "Release") {
strip -sv ./src/widelands.exe
}
# C:\"Program Files"\7-Zip\7z.exe a -tzip ../../Widelands-${{ github.sha }}-mingw-${{ matrix.config }}-${{ matrix.arch }}.zip widelands.exe
C:\"Program Files"\7-Zip\7z.exe a -tzip ../../${ARTIFACT_NAME}.zip widelands.exe
- name: Uploading executable
uses: actions/upload-artifact@v4
with:
name: Widelands ${{ matrix.config }} ${{ matrix.arch }} Binary Only (MinGW)
path: ${{ github.workspace }}\build\src\widelands.exe
path: ${{ github.workspace }}\${ARTIFACT_NAME}.zip
- name: InnoSetup
run: |
cd $env:GITHUB_WORKSPACE
Expand Down

0 comments on commit a2ab3a3

Please sign in to comment.