change deploy.yml #53
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: Deploy | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build-ubuntu-macos: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.*' | |
- name: Build for ${{ matrix.os }} | |
run: | | |
mkdir -p artifacts/${{ matrix.os }} | |
if [ ${{ matrix.os }} = 'ubuntu-latest' ]; then | |
GOOS=linux GOARCH=amd64 go build -o artifacts/${{ matrix.os }}/addframe-linux | |
elif [ ${{ matrix.os }} = 'macos-latest' ]; then | |
GOOS=darwin GOARCH=amd64 go build -o artifacts/${{ matrix.os }}/addframe_amd64 | |
GOOS=darwin GOARCH=arm64 go build -o artifacts/${{ matrix.os }}/addframe_arm64 | |
lipo -create -output artifacts/${{ matrix.os }}/addframe-macos artifacts/${{ matrix.os }}/addframe_amd64 artifacts/${{ matrix.os }}/addframe_arm64 | |
rm artifacts/${{ matrix.os }}/addframe_amd64 artifacts/${{ matrix.os }}/addframe_arm64 | |
fi | |
shell: bash | |
- name: Copy addframe.json | |
run: cp addframe.json artifacts/${{ matrix.os }}/ | |
shell: bash | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ matrix.os }} | |
path: artifacts/${{ matrix.os }} | |
build-windows: | |
runs-on: windows-latest | |
needs: build-ubuntu-macos | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.*' | |
- name: Build for Windows | |
run: | | |
mkdir -p artifacts/windows-latest | |
go build -o artifacts/windows-latest/addframe.exe | |
shell: pwsh | |
- name: Copy addframe.json | |
run: Copy-Item -Path addframe.json -Destination artifacts/windows-latest/ | |
shell: pwsh | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-windows-latest | |
path: artifacts/windows-latest | |
zip: | |
needs: [build-ubuntu-macos, build-windows] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./artifacts | |
- name: List build artifacts | |
run: | | |
echo "Current directory:" | |
pwd | |
echo "Listing files in artifacts/" | |
ls -la ./artifacts | |
ls -la ./artifacts/ | |
shell: bash | |
- name: Create ZIP files | |
run: | | |
mkdir -p artifacts/zipped-artifacts | |
# List files to confirm their existence before creating ZIP files | |
echo "Listing files in build-ubuntu-latest/" | |
ls -la artifacts/ubuntu-latest | |
echo "Listing files in build-macos-latest/" | |
ls -la artifacts/macos-latest | |
echo "Listing files in build-windows-latest/" | |
ls -la artifacts/windows-latest | |
# Create ZIP files | |
if [ -f artifacts/ubuntu-latest/addframe-linux ] && [ -f artifacts/ubuntu-latest/addframe.json ]; then | |
zip -r artifacts/zipped-artifacts/addframe-linux.zip artifacts/ubuntu-latest/addframe-linux artifacts/ubuntu-latest/addframe.json | |
fi | |
if [ -f artifacts/macos-latest/addframe-macos ] && [ -f artifacts/macos-latest/addframe.json ]; then | |
zip -r artifacts/zipped-artifacts/addframe-macos.zip artifacts/macos-latest/addframe-macos artifacts/macos-latest/addframe.json | |
fi | |
if [ -f artifacts/windows-latest/addframe.exe ] && [ -f artifacts/windows-latest/addframe.json ]; then | |
zip -r artifacts/zipped-artifacts/addframe-windows.zip artifacts/windows-latest/addframe.exe artifacts/windows-latest/addframe.json | |
fi | |
shell: bash | |
- name: List ZIP files | |
run: | | |
echo "Listing ZIP files in artifacts/zipped-artifacts/" | |
ls -la artifacts/zipped-artifacts/ | |
shell: bash | |
release: | |
needs: zip | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload ZIP files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zipped-artifacts | |
path: artifacts/zipped-artifacts/ | |
if-no-files-found: error | |
compression-level: 6 | |
overwrite: false | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
./artifacts/zipped-artifacts/addframe-linux.zip | |
./artifacts/zipped-artifacts/addframe-macos.zip | |
./artifacts/zipped-artifacts/addframe-windows.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |