Package #321
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Package | |
on: [push, pull_request] | |
env: | |
PRODUCT_NAME: ${{ vars.PRODUCT_NAME }} | |
PRODUCT_NAME_ANSI: ${{ vars.PRODUCT_NAME_ANSI }} | |
PRODUCT_NAME_SC: ${{ vars.PRODUCT_NAME_SC }} | |
BUNDLE_ID: com.example.${{ vars.PRODUCT_NAME_SC }} | |
BUILD_TYPE: ${{ fromJSON('["dev", "release"]')[startsWith(github.ref, 'refs/tags/v')] }} | |
OUTPUT_FOLDER: dist | |
ARTIFACT_FOLDER: artifact | |
LOVE_ARTIFACT_NAME: ${{ vars.PRODUCT_NAME_SC }}.love | |
LOVE_DEBUG_APK_NAME: ${{ vars.PRODUCT_NAME }}-debug.apk | |
LOVE_APK_NAME: ${{ vars.PRODUCT_NAME }}-release.apk | |
LOVE_APPIMAGE: ${{ vars.PRODUCT_NAME_ANSI }}.AppImage | |
LOVE_DEB: ${{ vars.PRODUCT_NAME_ANSI }}.deb | |
LOVE_JS: ${{ vars.PRODUCT_NAME }}-web.zip | |
jobs: | |
run-busted: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
- uses: jkl1337/gh-actions-lua@v11 | |
with: | |
# luaVersion: "5.3" | |
luaVersion: "luajit-git" | |
- uses: jkl1337/gh-actions-luarocks@v5 | |
with: | |
luarocksVersion: "3.9.2" | |
- name: install dependencies | |
run: | | |
luarocks --local install busted | |
luarocks --local install luautf8 | |
- name: run unit tests | |
run: busted tests -o utfTerminal | |
build-love: | |
runs-on: ubuntu-latest | |
needs: | |
- run-busted | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Build bare love package | |
uses: love-actions/love-actions-core@v1 | |
with: | |
build-list: "./src/*" | |
package-path: ${{ env.OUTPUT_FOLDER }}/${{ env.LOVE_ARTIFACT_NAME }} | |
- name: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.LOVE_ARTIFACT_NAME }} | |
path: ${{ env.OUTPUT_FOLDER }}/${{ env.LOVE_ARTIFACT_NAME }} | |
- name: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: game.love | |
path: ${{ env.OUTPUT_FOLDER }}/${{ env.LOVE_ARTIFACT_NAME }} | |
build-linux: | |
runs-on: ubuntu-latest | |
needs: build-love | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
fetch-depth: 0 | |
fetch-tags: "true" | |
- name: Download love package | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.LOVE_ARTIFACT_NAME }} | |
# path: ${{ env.ARTIFACT_FOLDER }}/${{ env.LOVE_ARTIFACT_NAME }} | |
- name: Build Linux packages | |
env: | |
ACTIONS_STEP_DEBUG: true | |
id: build-packages | |
uses: love-actions/love-actions-linux@v1 | |
with: | |
app-name: ${{ env.PRODUCT_NAME }} | |
bundle-id: ${{ env.BUNDLE_ID }} | |
love-package: ${{ env.LOVE_ARTIFACT_NAME }} | |
# love-package: ${{ env.ARTIFACT_FOLDER }}/${{ env.LOVE_ARTIFACT_NAME }} | |
product-name: ${{ env.PRODUCT_NAME_ANSI }} | |
output-folder: ${{ env.OUTPUT_FOLDER }} | |
icon-path: ./src/assets/example_icon.png | |
- name: upload .deb | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.LOVE_DEB }} | |
path: ${{ env.OUTPUT_FOLDER }}/${{ env.LOVE_DEB }} | |
- name: upload AppImage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.LOVE_APPIMAGE }} | |
path: ${{ env.OUTPUT_FOLDER }}/${{ env.LOVE_APPIMAGE }} | |
build-web: | |
runs-on: ubuntu-latest | |
needs: build-love | |
steps: | |
- name: install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/Iron" | |
- name: install just | |
uses: extractions/setup-just@v2 | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
fetch-depth: 0 | |
fetch-tags: "true" | |
- name: Download love package | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.LOVE_ARTIFACT_NAME }} | |
- name: Build web package | |
run: | | |
just setup-web-dev | |
just package-web | |
- name: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.LOVE_JS }} | |
path: ${{ env.OUTPUT_FOLDER }}/${{ env.LOVE_JS }} | |
deploy-staging: | |
runs-on: ubuntu-latest | |
needs: build-web | |
environment: staging | |
steps: | |
- name: Download package | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.LOVE_JS }} | |
- name: Setup ssh | |
env: | |
STAGING: ${{ secrets.STAGING }} | |
PORT: ${{ secrets.SSH_PORT }} | |
USER: ${{ secrets.STAGING_USER }} | |
SSH_KEY: ${{ secrets.STAGING_SSH_KEY }} | |
run: | | |
mkdir -p ~/.ssh | |
umask 077 | |
cat > ~/.ssh/config << EOF | |
Host staging | |
Hostname $STAGING | |
Port $PORT | |
User $USER | |
UserKnownHostsFile /dev/null | |
StrictHostKeyChecking no | |
IdentityFile ~/.ssh/deploy.key | |
EOF | |
echo "$SSH_KEY" > ~/.ssh/deploy.key | |
ssh-keyscan -H $STAGING || true >> ~/.ssh/known_hosts | |
- name: Deploy package | |
env: | |
PACKAGE: ${{ env.LOVE_JS }} | |
STAGING: ${{ secrets.STAGING }} | |
TDIR: public | |
run: | | |
rsync $PACKAGE staging: | |
ssh staging "7z -y -o$TDIR x $PACKAGE" | |
build-android: | |
runs-on: ubuntu-latest | |
needs: build-love | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
env: | |
ACTIONS_STEP_DEBUG: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
fetch-tags: "true" | |
fetch-depth: 0 | |
- name: Download love package | |
uses: actions/download-artifact@v4 | |
with: | |
name: game.love | |
path: ./ | |
- name: sed version code | |
id: sub | |
env: | |
VER: ${{ github.ref_name }} | |
run: echo VER_CODE="$(echo $VERSION | sed -e 's/^v//' -e 's/\.//g')" >> $GITHUB_ENV | |
- name: Package for android | |
uses: compy-toys/[email protected] | |
with: | |
love-ref: "loveputer" | |
no-soft-keyboard: "enabled" | |
app-name: ${{ env.PRODUCT_NAME }} | |
bundle-id: ${{ env.BUNDLE_ID }} | |
resource-path: "./res/android" | |
product-name: ${{ env.PRODUCT_NAME }} | |
version-string: ${{ github.ref_name }} | |
version-code: ${{ env.VER_CODE }} | |
output-folder: ${{ env.OUTPUT_FOLDER }} | |
love-package: ${{ env.LOVE_ARTIFACT_NAME }} | |
icon-specifier: "@drawable/${{ env.PRODUCT_NAME_SC }}" | |
keystore-alias: ${{ secrets.ANDROID_KEYSTORE_ALIAS }} | |
keystore-base64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | |
keystore-key-password: ${{ secrets.ANDROID_KEYSTORE_KEYPASSWORD }} | |
keystore-store-password: ${{ secrets.ANDROID_KEYSTORE_STOREPASSWORD }} | |
- name: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.LOVE_DEBUG_APK_NAME }} | |
path: ${{ env.OUTPUT_FOLDER }}/${{ env.LOVE_DEBUG_APK_NAME }} | |
- name: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.LOVE_APK_NAME }} | |
path: ${{ env.OUTPUT_FOLDER }}/${{ env.LOVE_APK_NAME }} | |
release: | |
permissions: | |
id-token: write | |
contents: write | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
needs: | |
- build-love | |
- build-linux | |
- build-web | |
- build-android | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.LOVE_ARTIFACT_NAME }} | |
path: ${{ env.ARTIFACT_FOLDER }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.LOVE_APPIMAGE }} | |
path: ${{ env.ARTIFACT_FOLDER }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.LOVE_DEB }} | |
path: ${{ env.ARTIFACT_FOLDER }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.LOVE_JS }} | |
path: ${{ env.ARTIFACT_FOLDER }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.LOVE_DEBUG_APK_NAME }} | |
path: ${{ env.ARTIFACT_FOLDER }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.LOVE_APK_NAME }} | |
path: ${{ env.ARTIFACT_FOLDER }} | |
- name: control | |
run: ls -lR ${{ env.ARTIFACT_FOLDER }}/ | |
- name: Checksums | |
run: | | |
cd ${{ env.ARTIFACT_FOLDER }} | |
sha256sum * > SHA256SUMS.txt | |
- uses: sigstore/[email protected] | |
with: | |
inputs: ${{ env.ARTIFACT_FOLDER }}/* | |
- name: control | |
run: ls -lR ${{ env.ARTIFACT_FOLDER }}/ | |
- name: Release | |
uses: softprops/[email protected] | |
with: | |
files: ${{ env.ARTIFACT_FOLDER }}/* |