|
| 1 | +name: ananicy-cpp |
| 2 | +'on': |
| 3 | + repository_dispatch: |
| 4 | + types: |
| 5 | + - ananicy-cpp |
| 6 | + workflow_dispatch: {} |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + include: |
| 12 | + - distro: main |
| 13 | + architecture: amd64 |
| 14 | + runner: ubuntu-latest |
| 15 | + - distro: main |
| 16 | + architecture: arm64 |
| 17 | + runner: ubuntu-24.04-arm |
| 18 | + runs-on: ${{ matrix.runner }} |
| 19 | + steps: |
| 20 | + - name: Init |
| 21 | + uses: actions/checkout@v4 |
| 22 | + - name: Set up QEMU |
| 23 | + uses: docker/setup-qemu-action@v3 |
| 24 | + - name: Set up SSH key |
| 25 | + run: | |
| 26 | + mkdir -p ~/.ssh |
| 27 | + echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_ed25519 |
| 28 | + chmod 600 ~/.ssh/id_ed25519 |
| 29 | + ssh-keyscan -H "${{ secrets.SSH_IP }}" >> ~/.ssh/known_hosts |
| 30 | + - name: Package |
| 31 | + run: | |
| 32 | + mkdir -p out && cd out |
| 33 | + m_name="ananicy-cpp" |
| 34 | + m_dist="${{ matrix.distro }}" |
| 35 | + m_arch="${{ matrix.architecture }}" |
| 36 | + ../scripts/packer.sh "${m_name}" "${m_dist}" "${m_arch}" |
| 37 | + debfile=(*${m_arch}.deb) |
| 38 | + echo "DEBNAME=${debfile}" >> $GITHUB_ENV |
| 39 | + - name: Upload .deb files |
| 40 | + uses: actions/upload-artifact@v4 |
| 41 | + with: |
| 42 | + name: ${{ env.DEBNAME }}@${{ matrix.distro }} |
| 43 | + path: out/${{ env.DEBNAME }} |
| 44 | + - name: Upload to server |
| 45 | + run: | |
| 46 | + LOCATION="${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}" |
| 47 | + LOCAL_PORT=8080 |
| 48 | + REMOTE_PORT=${{ secrets.APTLY_PORT }} |
| 49 | + REPO_URL="http://localhost:${LOCAL_PORT}/api/repos/ppr-${{ matrix.distro }}/packages" |
| 50 | + ssh -i ~/.ssh/id_ed25519 -fN -L ${LOCAL_PORT}:localhost:${REMOTE_PORT} "${LOCATION}" |
| 51 | + rm_str="$(./scripts/checker.sh overflow ananicy-cpp ${{ matrix.distro }} ${{ matrix.architecture }} 5 ${REPO_URL})" |
| 52 | + if [ -n "${rm_str}" ]; then |
| 53 | + echo "Removing ${rm_str}..." |
| 54 | + curl -X DELETE -H 'Content-Type: application/json' --data "{\"PackageRefs\": [${rm_str}]}" "${REPO_URL}" | jq |
| 55 | + fi |
| 56 | + curl -X POST -F file=@out/${{ env.DEBNAME }} "http://localhost:${LOCAL_PORT}/api/files/${{ matrix.distro }}" | jq |
| 57 | + curl -s -X POST -H 'Content-Type: application/json' \ |
| 58 | + "http://localhost:${LOCAL_PORT}/api/repos/ppr-${{ matrix.distro }}/file/${{ matrix.distro }}?forceReplace=1" | jq |
| 59 | + curl -X PUT -H 'Content-Type: application/json' --data '{"Signing": {"Skip": false, "GpgKey": "${{ secrets.GPG_KEY }}"}, "MultiDist": true, "ForceOverwrite": true}' "http://localhost:${LOCAL_PORT}/api/publish/pacstall/pacstall" | jq |
0 commit comments