ADDED: GitHub workflows permission to uplaod artifacts #10
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: Linux | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'src/**' | |
- '.github/workflows/linux.yml' | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
permissions: | |
contents: write # for actions/upload-release-asset to upload release asset | |
runs-on: ubuntu-20.04 | |
env: | |
PROJECT_NAME: ${{ github.event.repository.name }} | |
PROJECT_BUILD_PATH: ${{ github.event.repository.name }}/src | |
PROJECT_RELEASE_PATH: ${{ github.event.repository.name }}_dev_linux_x64 | |
PROJECT_CUSTOM_FLAGS: "" | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@master | |
with: | |
path: ${{ env.PROJECT_NAME }} | |
- name: Checkout raylib repo | |
uses: actions/checkout@v4 | |
with: | |
repository: raysan5/raylib | |
path: raylib | |
- name: Setup Release Paths | |
run: | | |
echo "PROJECT_RELEASE_PATH=${{ env.PROJECT_NAME }}_v${{ github.event.release.tag_name }}_linux_x64" >> $GITHUB_ENV | |
shell: bash | |
if: github.event_name == 'release' && github.event.action == 'published' | |
- name: Setup Environment | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libxkbcommon-dev | |
mkdir ${{ env.PROJECT_RELEASE_PATH }} | |
ls | |
shell: bash | |
- name: Build raylib Library | |
run: | | |
cd raylib/src | |
gcc --version | |
make PLATFORM=PLATFORM_DESKTOP BUILD_MODE=RELEASE RAYLIB_LIBTYPE=STATIC RAYLIB_PROJECT_RELEASE_PATH=. -B | |
- name: Build Product | |
run: | | |
cd ${{ env.PROJECT_NAME }}/src | |
make PLATFORM=PLATFORM_DESKTOP BUILD_MODE=RELEASE PROJECT_CUSTOM_FLAGS=${{ env.PROJECT_CUSTOM_FLAGS }} PROJECT_BUILD_PATH=. RAYLIB_SRC_PATH=../../raylib/src | |
- name: Generate Artifacts | |
run: | | |
ls ${{ env.PROJECT_BUILD_PATH }} | |
cp ${{ env.PROJECT_BUILD_PATH }}/${{ env.PROJECT_NAME }} ${{ env.PROJECT_RELEASE_PATH }} | |
cp ${{ env.PROJECT_NAME }}/README.md ${{ env.PROJECT_RELEASE_PATH }} | |
cp ${{ env.PROJECT_NAME }}/LICENSE ${{ env.PROJECT_RELEASE_PATH }} | |
ls ${{ env.PROJECT_RELEASE_PATH }} | |
7z a ./${{ env.PROJECT_RELEASE_PATH }}.zip ./${{ env.PROJECT_RELEASE_PATH }} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PROJECT_RELEASE_PATH }}.zip | |
path: ./${{ env.PROJECT_RELEASE_PATH }}.zip | |
- name: Upload Artifact to Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{ env.PROJECT_RELEASE_PATH }}.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: github.event_name == 'release' && github.event.action == 'published' |