diff --git a/.github/workflows/build-rock.yaml b/.github/workflows/build-rock.yaml index a7eda9f..20863b9 100644 --- a/.github/workflows/build-rock.yaml +++ b/.github/workflows/build-rock.yaml @@ -5,13 +5,5 @@ on: jobs: build-rock: - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - uses: canonical/craft-actions/rockcraft-pack@main - id: rockcraft - - uses: actions/upload-artifact@v4 - with: - name: rock - path: ${{ steps.rockcraft.outputs.rock }} + name: Build rock + uses: canonical/data-platform-workflows/.github/workflows/build_rock.yaml@v22.0.0 diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 9c817bf..911a2c1 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -17,19 +17,15 @@ concurrency: cancel-in-progress: true jobs: - build: uses: ./.github/workflows/build-rock.yaml - scan: needs: build uses: ./.github/workflows/scan-rock.yaml - integration-tests: needs: build uses: ./.github/workflows/integration-tests.yaml - publish: - if: github.ref_name == 'main' || startsWith(github.ref_name, 'release-') + # if: github.ref_name == 'main' || startsWith(github.ref_name, 'release-') needs: [scan, build, integration-tests] uses: ./.github/workflows/publish-rock.yaml diff --git a/.github/workflows/publish-rock.yaml b/.github/workflows/publish-rock.yaml index e2c8b33..fba7907 100644 --- a/.github/workflows/publish-rock.yaml +++ b/.github/workflows/publish-rock.yaml @@ -5,35 +5,10 @@ on: jobs: publish-rock: - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to the Container registry - uses: docker/login-action@v3.3.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Install rockcraft - run: | - sudo snap install rockcraft --classic --channel edge - - uses: actions/download-artifact@v4 - with: - name: rock - - - name: Import and push to github package - run: | - image_name="$(yq '.name' rockcraft.yaml)" - version="$(yq '.version' rockcraft.yaml)" - rock_file=$(ls *.rock | tail -n 1) - sudo rockcraft.skopeo \ - --insecure-policy \ - copy \ - oci-archive:"${rock_file}" \ - docker-daemon:"ghcr.io/canonical/${image_name}:${version}" - docker tag ghcr.io/canonical/${image_name}:${version} ghcr.io/canonical/${image_name}:latest - docker push ghcr.io/canonical/${image_name}:${version} - docker push ghcr.io/canonical/${image_name}:latest + name: Publish rock + uses: canonical/data-platform-workflows/.github/workflows/release_rock.yaml@v22.0.0 + with: + artifact-prefix: ${{ needs.go-build.outputs.artifact-prefix }} + permissions: + packages: write + contents: write \ No newline at end of file