Skip to content

add permissions

add permissions #31

Workflow file for this run

name: Build project
on:
workflow_dispatch:
push:
tags:
- v*
branches:
- master
jobs:
package_macos:
name: Package (macos-latest)
uses: ./.github/workflows/build-package.yaml
with:
os: macos-latest
package_windows:
name: Package (windows-latest)
uses: ./.github/workflows/build-package.yaml
with:
os: windows-latest
package_linux:
name: Package (ubuntu-latest)
uses: ./.github/workflows/build-package.yaml
with:
os: ubuntu-latest
build_rpm:
name: Build RPM
needs:
- package_linux
runs-on: ubuntu-latest
steps:
- name: Extract Version Name
id: extract_name
uses: actions/github-script@v7
with:
result-encoding: string
script: |
if (context.payload.ref.startsWith('refs/tags/')) {
return context.payload.ref.replace(/refs\/tags\/v/, '');
}
return 'dev';
- name: Checkout code
uses: actions/checkout@v4
- name: Install rpm
run: sudo apt-get -y install rpm
- name: Download built
uses: actions/download-artifact@v4
with:
name: ubuntu-latest
- name: Create sources directory
run: mkdir -p rpm/SOURCES
- name: Move file
run: mv LargeCsvReader.tar.xz rpm/SOURCES
- name: Build RPM
run: rpmbuild -ba --define "_topdir $(pwd)/rpm" --define "app_version ${{ steps.extract_name.outputs.result }}" rpm/LargeCsvReader.spec
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: rpm/RPMS/x86_64/LargeCsvReader-${{ steps.extract_name.outputs.result }}-1.x86_64.rpm
name: rpm
build_win_installer:
name: Build Windows installer
needs:
- package_windows
runs-on: windows-latest
steps:
- name: Extract Version Name
id: extract_name
uses: actions/github-script@v7
with:
result-encoding: string
script: |
if (context.payload.ref.startsWith('refs/tags/')) {
return context.payload.ref.replace(/refs\/tags\/v/, '');
}
return 'dev';
- name: Checkout Code
uses: actions/checkout@v4
- name: Download built
uses: actions/download-artifact@v4
with:
name: windows-latest
- name: Set version
env:
VERSION: ${{ steps.extract_name.outputs.result }}
run: echo %VERSION% > appversion
- name: Move file
run: mv LargeCsvReader.exe windows
- name: Create Windows setup
run: iscc setup.iss
working-directory: windows
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: windows/Output/LargeCsvReaderSetup.exe
name: win_installer
create_release:
name: Create a release
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags/v')
permissions:
contents: write
needs:
- package_windows
- package_linux
- package_macos
- build_rpm
- build_win_installer
steps:
- name: Extract Version Name
id: extract_name
uses: actions/github-script@v7
with:
result-encoding: string
script: |
return context.payload.ref.replace(/refs\/tags\/v/, '');
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Compress MacOS version
run: 7z a -tzip LargeCsvReader.zip LargeCsvReader.app
working-directory: artifacts
- name: Create a Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Release ${{ steps.extract_name.outputs.result }}
draft: false
prerelease: false
generate_release_notes: true
fail_on_unmatched_files: true
body: |
For Windows: Either the `LargeCsvReader.exe` (portable) or `LargeCsvReaderSetup.exe` (installer).
For Linux: `LargeCsvReader-${{ steps.extract_name.outputs.result }}-1.x86_64.rpm` if your distribution supports RPM, otherwise `LargeCsvReader.tar.xz` (extract it somewhere and run `sudo make install`)
For MacOS: `LargeCsvReader.zip`, extract `LargeCsvReader.app` anywhere you want and open it.
files: artifacts/*