diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..0fc77f5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,169 @@ +name: Build and publish FastQC release + +on: + push: + branches: [master] + pull_request: + release: + types: [published] + workflow_dispatch: + inputs: + tag_name: + description: 'Tag or version string to use in artifact filenames when running manually (e.g., v0.12.1)' + required: false + default: 'dev' + +permissions: + contents: write + +jobs: + build-zip: + name: Build ZIP (Win/Linux) + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Java 11 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '11' + + - name: Build with Ant + run: ant clean build + + - name: Ensure executable flags + run: chmod +x bin/fastqc + + - name: Stage distribution folder + run: | + rm -rf FastQC + mkdir -p FastQC + cp -a bin/. FastQC/ + + - name: Determine version + id: vars + shell: bash + run: | + if [ "${{ github.event_name }}" = "release" ]; then + echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT + elif [ "${{ github.event_name }}" = "push" ]; then + echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT + elif [ "${{ github.event_name }}" = "pull_request" ]; then + echo "version=PR-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT + else + echo "version=${{ github.event.inputs.tag_name }}" >> $GITHUB_OUTPUT + fi + + - name: Create ZIP archive + run: zip -r "fastqc_${{ steps.vars.outputs.version }}.zip" FastQC + + - name: Upload asset to GitHub Release + if: github.event_name == 'release' + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.event.release.tag_name }} + files: fastqc_${{ steps.vars.outputs.version }}.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload artifact (manual run) + if: github.event_name != 'release' + uses: actions/upload-artifact@v4 + with: + name: fastqc_${{ steps.vars.outputs.version }}.zip + path: fastqc_${{ steps.vars.outputs.version }}.zip + + build-dmg: + name: Build DMG (macOS) + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Java 11 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '11' + + - name: Build with Ant + run: ant clean build + + - name: Ensure executable flags + run: chmod +x bin/fastqc + + - name: Stage distribution folder + run: | + mkdir -p FastQC.app/Contents/MacOS + mkdir -p FastQC.app/Contents/Resources + cp -a bin/. FastQC.app/Contents/MacOS/ + cp -a bin/uk/ac/babraham/FastQC/Resources/fastqc_icons.icns FastQC.app/Contents/Resources/fastqc_icons.icns + echo "APPL????" > FastQC.app/Contents/PkgInfo + chmod 777 FastQC.app/Contents/PkgInfo + cat > FastQC.app/Contents/Info.plist << 'EOF' + + + + + CFBundleAllowMixedLocalizations + true + CFBundleDevelopmentRegion + English + CFBundleExecutable + fastqc + CFBundleIconFile + fastqc_icons.icns + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + FastQC + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 0.12.0 + + + EOF + chmod 777 FastQC.app/Contents/Info.plist + + + + - name: Determine version + id: vars + shell: bash + run: | + if [ "${{ github.event_name }}" = "release" ]; then + echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT + elif [ "${{ github.event_name }}" = "push" ]; then + echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT + elif [ "${{ github.event_name }}" = "pull_request" ]; then + echo "version=PR-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT + else + echo "version=${{ github.event.inputs.tag_name }}" >> $GITHUB_OUTPUT + fi + + - name: Create DMG image + run: | + hdiutil create -volname "FastQC" -srcfolder FastQC.app -ov -format UDZO "fastqc_${{ steps.vars.outputs.version }}.dmg" + + - name: Upload asset to GitHub Release + if: github.event_name == 'release' + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.event.release.tag_name }} + files: fastqc_${{ steps.vars.outputs.version }}.dmg + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload artifact (manual run) + if: github.event_name != 'release' + uses: actions/upload-artifact@v4 + with: + name: fastqc_${{ steps.vars.outputs.version }}.dmg + path: fastqc_${{ steps.vars.outputs.version }}.dmg + + diff --git a/uk/ac/babraham/FastQC/Resources/fastqc_icons.icns b/uk/ac/babraham/FastQC/Resources/fastqc_icons.icns new file mode 100755 index 0000000..c54a987 Binary files /dev/null and b/uk/ac/babraham/FastQC/Resources/fastqc_icons.icns differ