Update release.yml

This commit is contained in:
Yvan Sraka 2023-06-06 14:05:42 +02:00 committed by GitHub
parent 7474ed7e4c
commit eb060cd480
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,9 @@
name: Build and Release name: Build and Release
on: on:
push: push:
branches: tags:
- main - '*'
jobs: jobs:
build: build:
@ -14,16 +14,16 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Setup Nix - name: Setup Nix
uses: cachix/install-nix-action@v20 uses: cachix/install-nix-action@v20
- name: Build - name: Build
run: nix build .#packages.${{ matrix.platform }}.default run: nix build .#packages.${{ matrix.platform }}.default --accept-flake-config
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
with: with:
name: foliage-${{ matrix.platform }} name: foliage-${{ matrix.platform }}
path: ./result path: ./result
@ -32,9 +32,12 @@ jobs:
needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: write
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Download Artifacts - name: Download Artifacts
run: | run: |
@ -44,29 +47,7 @@ jobs:
unzip artifacts/$platform/foliage.zip -d artifacts/$platform unzip artifacts/$platform/foliage.zip -d artifacts/$platform
done done
- name: Create Release - name: Create Release and Upload Release Assets
id: create_release uses: ncipollo/release-action@v1
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: ${{ github.ref }} artifacts: "artifacts/*"
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Assets
run: |
for platform in aarch64-linux aarch64-darwin x86_64-linux x86_64-darwin; do
asset_path=artifacts/$platform/foliage
asset_name=foliage-$platform
asset_content_type=application/octet-stream
upload_url=${{ steps.create_release.outputs.upload_url }}
echo "Uploading $asset_name to $upload_url ..."
curl \
--header 'Content-Type: $asset_content_type' \
--header 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--data-binary @$asset_path \
--upload-file $asset_path \
$upload_url?name=$asset_name
done