Skip to content

Commit

Permalink
Fix webrepl release (#221)
Browse files Browse the repository at this point in the history
* Fix GitHub Action Docker release
  • Loading branch information
ksclarke authored Nov 8, 2024
1 parent 1ec06e5 commit d55b811
Showing 1 changed file with 10 additions and 42 deletions.
52 changes: 10 additions & 42 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
java: [ "21" ]
maven: [ "3.8.2" ]
jdk: [ "temurin" ]
cosign: [ "v2.4.1" ]

steps:
- name: Check out source code
Expand All @@ -29,9 +28,6 @@ jobs:
with:
platforms: all

#- name: Set up Docker Buildx
# uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1

- name: Set up Docker
uses: crazy-max/ghaction-setup-docker@26145a578dce008fee793528d031cd72c57d51af # v3.4.0
with:
Expand All @@ -56,12 +52,20 @@ jobs:
distribution: ${{ matrix.jdk }}
java-version: ${{ matrix.java }}

- name: Set release version
- name: Set environmental variables
shell: bash
run: |
GITHUB_REF="${{ github.ref }}" &&
TAG_NAME="${GITHUB_REF#refs/tags/}" &&
echo "RELEASE_VERSION=${TAG_NAME#webrepl-}" >> $GITHUB_ENV
# Use 'latest' instead of tag, if being run on a PR branch
if [[ $TAG_NAME == "refs/pull/"* ]]; then
echo "RELEASE_VERSION=latest" >> $GITHUB_ENV
else
echo "RELEASE_VERSION=${TAG_NAME#webrepl-}" >> $GITHUB_ENV
fi &&
# Set Docker host ENV so the docker-maven-plugin will find the correct Docker instance
DOCKER_HOST="$(ps aux | grep '[d]ockerd' | grep -o -- '--host=[^ ]*' | sed 's/--host=//')"
echo "DOCKER_HOST=${DOCKER_HOST}" >> $GITHUB_ENV
- name: Set up Maven if needed
if: ${{ env.ACT }}
Expand All @@ -81,39 +85,3 @@ jobs:
run: |
mvn -B -ntp deploy -Prelease -Drevision="${{ env.RELEASE_VERSION }}" -DskipNexusStagingDeployMojo="true" \
-Ddocker.sbom=true -Ddocker.provenance=true
# - name: Build and push Docker image with SBOM
# uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
# with:
# tags: ${{ secrets.DOCKER_ACCOUNT }}/${{ env.ARTIFACT_NAME }}:${{ env.RELEASE_VERSION }}
# push: true
# sbom: true

# - name: Install Syft and generate SBOM
# run: |
# curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
# syft ${{ secrets.DOCKER_ACCOUNT }}/${{ env.ARTIFACT_NAME }}:${{ env.RELEASE_VERSION }} -o json > sbom.json

# - name: Install Cosign and prepare private key
# env:
# COSIGN_URL: "https://github.com/sigstore/cosign/releases/download"
# run: |
# curl -sSfL ${{ env.COSIGN_URL }}/${{ matrix.cosign }}/cosign-linux-amd64 -o /usr/local/bin/cosign
# chmod +x /usr/local/bin/cosign
# echo "${{ secrets.COSIGN_PRIVATE_KEY }}" > $RUNNER_TEMP/cosign.key
# chmod 600 $RUNNER_TEMP/cosign.key

# - name: Sign Docker image with Cosign
# env:
# COSIGN_EXPERIMENTAL: "true"
# COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
# run: |
# cosign sign --yes --key $RUNNER_TEMP/cosign.key \
# ${{ secrets.DOCKER_ACCOUNT }}/${{ env.ARTIFACT_NAME }}:${{ env.RELEASE_VERSION }}

# - name: Attest Docker image with Cosign
# env:
# COSIGN_EXPERIMENTAL: "true"
# run: |
# cosign attest --verbose --yes --key $RUNNER_TEMP/cosign.key --predicate sbom.json --type spdx \
# ${{ secrets.DOCKER_ACCOUNT }}/${{ env.ARTIFACT_NAME }}:${{ env.RELEASE_VERSION }}

0 comments on commit d55b811

Please sign in to comment.