workflow: bump actions/* to v4 #7
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: Build 3DEins | |
on: | |
push: | |
branches-ignore: [translation] | |
pull_request: | |
branches: ["*"] | |
release: | |
types: [created] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: devkitpro/devkitarm | |
name: Build with Docker using devkitARM | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Setup environment | |
run: git config --global safe.directory '*' | |
- name: Install tools | |
run: | | |
sudo apt-get update | |
sudo apt-get install p7zip-full -y | |
curl -L https://github.com/Epicpkmn11/bannertool/releases/download/v1.2.2/bannertool.zip -o bannertool.zip | |
sudo 7z e bannertool.zip linux-x86_64/bannertool | |
sudo chmod +x bannertool | |
mv bannertool /usr/local/bin | |
rm bannertool.zip | |
curl -L https://github.com/3DSGuy/Project_CTR/releases/download/makerom-v0.17/makerom-v0.17-ubuntu_x86_64.zip -o makerom-v0.17-ubuntu_x86_64.zip | |
sudo 7z e makerom-v0.17-ubuntu_x86_64.zip | |
sudo chmod +x makerom | |
mv makerom /usr/local/bin | |
rm makerom-v0.17-ubuntu_x86_64.zip | |
curl -L https://github.com/Universal-Team/bmp2ds/releases/download/v1.1.0/bmp2ds-linux -o bmp2ds | |
chmod +x bmp2ds | |
mv bmp2ds /usr/local/bin | |
- name: Build | |
id: build | |
run: | | |
make | |
mkdir -p ~/artifacts | |
tools-linux/make_cia --srl="ds/DSEins.nds" | |
cp 3ds/3DEins.3dsx ~/artifacts | |
cp 3ds/3DEins.cia ~/artifacts | |
cp ds/DSEins.nds ~/artifacts | |
cp ds/DSEins.cia ~/artifacts/DSEins.nds.cia | |
- name: Publish build to GH Actions | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ~/artifacts/* | |
name: build | |
# Only run this for non-PR jobs. | |
publish_build: | |
runs-on: ubuntu-latest | |
name: Publish build | |
if: ${{ success() && !startsWith(github.ref, 'refs/pull') }} | |
needs: build | |
steps: | |
- name: Install tools | |
run: | | |
sudo apt-get update | |
sudo apt-get install qrencode -y | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: build | |
path: build | |
- name: Upload to ${{ github.repository }} release | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
run: | | |
ID=$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH) | |
for file in ${{ github.workspace }}/build/*; do | |
AUTH_HEADER="Authorization: token ${{ secrets.GITHUB_TOKEN }}" | |
CONTENT_LENGTH="Content-Length: $(stat -c%s $file)" | |
CONTENT_TYPE="Content-Type: application/7z-x-compressed" | |
UPLOAD_URL="https://uploads.github.com/repos/${{ github.repository }}/releases/$ID/assets?name=$(basename $file)" | |
curl -XPOST -H "$AUTH_HEADER" -H "$CONTENT_LENGTH" -H "$CONTENT_TYPE" --upload-file "$file" "$UPLOAD_URL" | |
done |