build: github workflow cleanups #192
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
| name: upload | ||
| on: | ||
| push: | ||
| branches: [master] | ||
| release: | ||
| types: [published] | ||
| jobs: | ||
| build-static: | ||
| name: build static binary | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ghcr.io/linux-nvme/debian:latest | ||
| outputs: | ||
| VERSION: ${{ steps.build.outputs.VERSION }} | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Mark repo as safe for git | ||
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
| - name: build | ||
| id: build | ||
| run: | | ||
| git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
| VERSION="$(git describe --always --abbrev=12 --dirty)" | ||
| echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | ||
| echo $VERSION | ||
| scripts/build.sh static | ||
| mkdir upload | ||
| cp .build-ci/nvme upload/nvme-cli-latest-x86_64 | ||
| if [ "${GITHUB_EVENT_NAME}" = "release" ]; then | ||
| cp .build-ci/nvme "upload/nvme-cli-${VERSION}-x86_64" | ||
| fi | ||
| - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | ||
| name: upload artifacts to github | ||
| with: | ||
| name: nvme-cli | ||
| path: upload/* | ||
| upload-test-binary: | ||
| name: upload test binary | ||
| runs-on: ubuntu-latest | ||
| needs: build-static | ||
| if: ${{ github.event_name == 'push' || github.event_name == 'release' }} && github.repository == 'linux-nvme/nvme-cli' | ||
|
Check warning on line 50 in .github/workflows/upload.yml
|
||
| steps: | ||
| - uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 | ||
| with: | ||
| name: nvme-cli | ||
| path: upload | ||
| - name: FTP Deployer | ||
| uses: sand4rt/ftp-deployer@518beaad91d1b18fd55a69321de7ed89080d2ae3 # v1.8 | ||
| with: | ||
| sftp: true | ||
| host: ${{ secrets.SFTP_SERVER }} | ||
| port: 22 | ||
| username: ${{ secrets.SFTP_USERNAME }} | ||
| password: ${{ secrets.SFTP_PASSWORD }} | ||
| remote_folder: '/upload' | ||
| local_folder: upload | ||
| cleanup: false | ||
| include: '[ "nvme-cli-*" ]' | ||
| exclude: '[".github/**", ".git/**", "*.env"]' | ||
| upload-release-assets: | ||
| name: upload GitHub release assets | ||
| runs-on: ubuntu-latest | ||
| needs: build-static | ||
| env: | ||
| VERSION: ${{ needs.build-static.outputs.VERSION }} | ||
| if: ${{ github.event_name == 'release' }} && github.repository == 'linux-nvme/nvme-cli' | ||
|
Check warning on line 77 in .github/workflows/upload.yml
|
||
| steps: | ||
| - uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 | ||
| with: | ||
| name: nvme-cli | ||
| path: upload | ||
| - name: upload versioned binary | ||
| uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 | ||
| with: | ||
| upload_url: ${{ github.event.release.upload_url }} | ||
| asset_path: upload/nvme-cli-${{ env.VERSION }}-x86_64 | ||
| asset_name: nvme-cli-${{ env.VERSION }}-x86_64 | ||
| asset_content_type: application/octet-stream | ||