diff --git a/.github/workflows/create-arm.yml b/.github/workflows/create-arm.yml index 94e3a7d6..5848938a 100644 --- a/.github/workflows/create-arm.yml +++ b/.github/workflows/create-arm.yml @@ -28,34 +28,41 @@ jobs: build: runs-on: ubuntu-latest outputs: - json: ${{ steps.scw.outputs.json }} id: ${{ steps.getinfo.outputs.id }} ip: ${{ steps.getinfo.outputs.ip }} steps: # Prepare - name: Checkout source code uses: actions/checkout@v4 - - name: Create ARM VM - id: scw + - name: Get ARM availabilities + id: availabilities uses: scaleway/action-scw@c718eca1fcb9fec1fb1433752d61599c6a0ad2e9 with: - args: instance server create zone=fr-par-2 type=AMP2-C48 root-volume=block:50GB - save-config: true + args: instance server-type get zone=fr-par-2 + export-config: true access-key: ${{ secrets.SCW_ACCESS_KEY }} secret-key: ${{ secrets.SCW_SECRET_KEY }} default-project-id: ${{ secrets.SCW_DEFAULT_PROJECT_ID }} default-organization-id: ${{ secrets.SCW_DEFAULT_ORGANIZATION_ID }} + - name: Extract ARM type + run: | + TYPE=$(echo "${{ steps.availabilities.outputs.json }}" | jq '.servers | with_entries(select(.key | contains("AMP"))) | with_entries(select(.value.availability != "shortage")) | keys[] | select(. | test("^AMP2-C[0-9]+$")) | sub("AMP2-C"; "") | tonumber' | sort -n | tail -n 1 | xargs -I {} echo "AMP2-C{}") + echo "Type is $TYPE" + echo "TYPE=$TYPE" >> "$GITHUB_ENV" + - name: Create ARM VM + id: scw + uses: scaleway/action-scw@c718eca1fcb9fec1fb1433752d61599c6a0ad2e9 + with: + args: instance server create zone=fr-par-2 type=${{ env.TYPE }} root-volume=block:50GB - name: Get info id: getinfo run: | echo "id=${{ fromJson(steps.scw.outputs.json).id }}" >> "$GITHUB_OUTPUT" echo "ip=${{ fromJson(steps.scw.outputs.json).public_ip.address }}" >> "$GITHUB_OUTPUT" - name: Wait for VM - run: scw instance server wait ${{ fromJson(steps.scw.outputs.json).ID }} zone=fr-par-2 - - name: Configure boot volume - run: scw instance server update ${{ fromJson(steps.scw.outputs.json).ID }} zone=fr-par-2 volumes.${{ fromJson(steps.scw.outputs.json).image.root_volume.id }}.boot=true - - name: Start VM - run: scw instance server start ${{ fromJson(steps.scw.outputs.json).ID }} zone=fr-par-2 + uses: scaleway/action-scw@c718eca1fcb9fec1fb1433752d61599c6a0ad2e9 + with: + args: instance server wait ${{ fromJson(steps.scw.outputs.json).ID }} zone=fr-par-2 - name: Wait for SSH uses: iFaxity/wait-on-action@628831cec646e6dacca502f34a6c6b46e131e51d with: diff --git a/.github/workflows/push-docker.yml b/.github/workflows/push-docker.yml index dbbac0a0..1fda9754 100644 --- a/.github/workflows/push-docker.yml +++ b/.github/workflows/push-docker.yml @@ -6,6 +6,9 @@ on: IMAGE: required: true type: string + TAGS: + required: true + type: string CACHE_FROM: required: true type: string @@ -36,6 +39,12 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_TOKEN }} + - name: Login to ghcr + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Setup SSH for ARM node run: | mkdir -p ~/.ssh @@ -51,6 +60,12 @@ jobs: with: endpoint: ssh://root@arm platforms: linux/arm64,linux/arm/v7,linux/arm/v6 + # Compute metadata + - name: Extract metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: bunkerity/${{ inputs.IMAGE }} # Build and push - name: Build and push uses: docker/build-push-action@v4 @@ -59,8 +74,9 @@ jobs: file: ${{ inputs.DOCKERFILE }} platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7 push: true - tags: ${{ inputs.IMAGE }} + tags: ${{ inputs.TAGS }} + labels: ${{ steps.meta.outputs.labels }} cache-from: | - type=registry,ref=bunkerity/cache:${{ inputs.CACHE_FROM }}-amd64 - type=registry,ref=bunkerity/cache:${{ inputs.CACHE_FROM }}-386 - type=registry,ref=bunkerity/cache:${{ inputs.CACHE_FROM }}-arm + type=gha,scope=${{ inputs.CACHE_FROM }}-amd64 + type=gha,scope=${{ inputs.CACHE_FROM }}-386 + type=gha,scope=${{ inputs.CACHE_FROM }}-arm diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d4201393..bdf5b180 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,9 +9,6 @@ on: jobs: # Build amd64 + 386 containers images build-containers: - permissions: - contents: read - packages: write strategy: matrix: image: [bunkerweb, scheduler, autoconf, ui] @@ -58,9 +55,6 @@ jobs: # Build arm64 + arm/v7 images build-containers-arm: - permissions: - contents: read - packages: write needs: [create-arm] strategy: matrix: @@ -169,7 +163,8 @@ jobs: dockerfile: src/ui/Dockerfile uses: ./.github/workflows/push-docker.yml with: - IMAGE: bunkerity/${{ matrix.image }}:${{ matrix.release }},bunkerity/${{ matrix.image }}:${{ needs.wait-builds.outputs.version }} + IMAGE: ${{ matrix.image }} + TAGS: bunkerity/${{ matrix.image }}:${{ matrix.release }},bunkerity/${{ matrix.image }}:${{ needs.wait-builds.outputs.version }},ghcr.io/bunkerity/${{ matrix.image }}:${{ matrix.release }},ghcr.io/bunkerity/${{ matrix.image }}:${{ needs.wait-builds.outputs.version }} CACHE_FROM: ${{ matrix.cache_from }}-${{ matrix.release }} DOCKERFILE: ${{ matrix.dockerfile }} secrets: diff --git a/src/VERSION b/src/VERSION index 4cda8f19..a73b4325 100644 --- a/src/VERSION +++ b/src/VERSION @@ -1 +1 @@ -1.5.2 +1.5.2 \ No newline at end of file