v2.49.0 #49
Workflow file for this run
This file contains hidden or 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
| # Builds for all operating system platforms, and uploads executable to the release | |
| # This workflow uses both self-hosted runners | |
| name: Build and Upload Artifact | |
| on: | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| lint-and-test: | |
| uses: | |
| ./.github/workflows/pre-release.yml | |
| with: | |
| build: 'false' | |
| release-check: | |
| runs-on: thevickypedia-default | |
| needs: lint-and-test | |
| outputs: | |
| release-id: ${{ steps.get-release-id.outputs.release_id }} | |
| release-tag: ${{ steps.get-release-id.outputs.release_tag }} | |
| steps: | |
| - name: Check Release ID | |
| id: get-release-id | |
| run: | | |
| if [ -n "${{ github.event.release.id }}" ]; then | |
| echo "Release ID: ${{ github.event.release.id }}" | |
| echo "release_id=${{ github.event.release.id }}" >> $GITHUB_OUTPUT | |
| echo "release_tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "Failed to fetch current release id, trying to fetch externally" | |
| release_id=$(curl -s -X GET \ | |
| -H "Authorization: token ${{ secrets.GIT_TOKEN }}" \ | |
| "https://api.github.com/repos/${{ github.repository }}/releases/latest" | \ | |
| jq -r ".id") | |
| if [ -n "$release_id" ]; then | |
| echo "Release ID: $release_id" | |
| echo "release_id=$release_id" >> $GITHUB_OUTPUT | |
| echo "release_tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
| else | |
| echo "::error title=Failed::Release ID not available in the event" | |
| exit 1 | |
| fi | |
| fi | |
| shell: bash | |
| # Upload assets for different OS and Architecture | |
| build-and-upload: | |
| if: ${{ github.event_name == 'release' }} | |
| needs: release-check | |
| strategy: | |
| matrix: | |
| platform: | |
| # Naming Convention: {operating_system}-{architecture}-{package_name}.{archive_format} | |
| - release_for: darwin-amd64 | |
| bin: filebrowser | |
| name: darwin-amd64-filebrowser.tar.gz | |
| pkg-name: darwin-amd64-filebrowser | |
| - release_for: darwin-arm64 | |
| bin: filebrowser | |
| name: darwin-arm64-filebrowser.tar.gz | |
| pkg-name: darwin-arm64-filebrowser | |
| - release_for: linux-amd64 | |
| bin: filebrowser | |
| name: linux-amd64-filebrowser.tar.gz | |
| pkg-name: linux-amd64-filebrowser | |
| - release_for: linux-arm64 | |
| bin: filebrowser | |
| name: linux-arm64-filebrowser.tar.gz | |
| pkg-name: linux-arm64-filebrowser | |
| - release_for: windows-amd64 | |
| bin: filebrowser.exe | |
| name: windows-amd64-filebrowser.zip | |
| pkg-name: windows-amd64-filebrowser | |
| name: Upload asset for ${{ matrix.platform.release_for }} | |
| runs-on: ${{ matrix.platform.release_for }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Release ID Propagation | |
| run: | | |
| if [ -n "${{ needs.release-check.outputs.release-id }}" ]; then | |
| echo "Release ID propagated: ${{ needs.release-check.outputs.release-id }}" | |
| else | |
| echo "Release ID propagation failed. Exiting.." | |
| exit 1 | |
| fi | |
| echo "start_time=$(date +%s)" >> "$GITHUB_ENV" | |
| shell: bash | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25' | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24.x" | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| package_json_file: "frontend/package.json" | |
| dest: ${{ runner.temp }}/setup-pnpm-${{ github.job }}-${{ github.run_id }} | |
| # IMPORTANT: frontend should be built first, since it is required when creating the binary | |
| - name: Build Frontend | |
| run: make build-frontend | |
| shell: bash | |
| - name: Build Backend | |
| run: make build-backend | |
| shell: bash | |
| - name: Copy Asset (Windows) | |
| if: startsWith(matrix.platform.release_for, 'windows') | |
| run: | | |
| mkdir -p ${{ matrix.platform.pkg-name }} | |
| cp ${{ matrix.platform.bin }} ${{ matrix.platform.pkg-name }}/${{ matrix.platform.bin }} | |
| Compress-Archive -DestinationPath ${{ matrix.platform.name }} -Path ${{ matrix.platform.pkg-name }} | |
| shell: pwsh | |
| - name: Copy Asset (macOS/Linux/RaspberryPi) | |
| if: "!startsWith(matrix.platform.release_for, 'windows')" | |
| run: | | |
| mkdir -p ${{ matrix.platform.pkg-name }} | |
| cp ${{ matrix.platform.bin }} ${{ matrix.platform.pkg-name }}/${{ matrix.platform.bin }} | |
| tar -zcvf ${{ matrix.platform.name }} ${{ matrix.platform.pkg-name }} | |
| shell: bash | |
| - name: Upload Artifact | |
| run: | | |
| curl -X POST -H "Authorization: token ${{ secrets.GIT_TOKEN }}" \ | |
| -H "Content-Type: application/octet-stream" \ | |
| --data-binary @"${{ matrix.platform.name }}" \ | |
| "https://uploads.github.com/repos/${{ github.repository }}/releases/${{ needs.release-check.outputs.release-id }}/assets?name=${{ matrix.platform.name }}" | |
| shell: bash | |
| - name: Runtime Analyzer | |
| run: | | |
| start=${{ env.start_time }} | |
| end=$(date +%s) | |
| time_taken=$((end-start)) | |
| url="${{ github.server_url }}/${{ github.repository }}/releases/download/${{ needs.release-check.outputs.release-tag }}/${{ matrix.platform.name }}" | |
| hyperlink="[${{ matrix.platform.release_for }}]($url)" | |
| echo "π Built for $hyperlink in $time_taken seconds" >> $GITHUB_STEP_SUMMARY | |
| shell: bash | |
| docker-publish-release: | |
| if: ${{ github.event_name == 'release' }} | |
| needs: | |
| - release-check | |
| - build-and-upload | |
| uses: | |
| ./.github/workflows/build-publish.yml | |
| with: | |
| tag_name: ${{ needs.release-check.outputs.release-tag }} | |
| dockerfile: 'thevickypedia/docker/release/Dockerfile' | |
| secrets: inherit | |
| docker-build-and-publish: | |
| if: ${{ github.event_name == 'release' }} | |
| needs: | |
| - release-check | |
| uses: | |
| ./.github/workflows/build-publish.yml | |
| with: | |
| tag_name: ${{ needs.release-check.outputs.release-tag }} | |
| dockerfile: 'thevickypedia/docker/base/Dockerfile' | |
| secrets: inherit |