Skip to content

Commit

Permalink
Splits docker build workflow (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor authored Jan 31, 2024
1 parent 2b3fc26 commit b06ad24
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/build-test-gumtree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
container: gumtreediff/gumtree:latest
environment: MavenCentral
if: "!(contains(github.event.head_commit.message, '[no ci]') || startsWith(github.event.head_commit.message, 'doc'))"
if: ${{ !(contains(github.event.head_commit.message, '[no ci]') || startsWith(github.event.head_commit.message, 'doc')) }}
steps:
- name: checkout gumtree
uses: actions/checkout@v4
Expand Down Expand Up @@ -56,32 +56,37 @@ jobs:
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEUSERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEPASSWORD }}
if: "github.event_name == 'schedule' && contains(steps.version.outputs.VERSION, 'SNAPSHOT')"
if: ${{ github.event_name == 'schedule' && contains(steps.version.outputs.VERSION, 'SNAPSHOT') }}
run: ./gradlew publish

- name: upload release package
if: "github.event_name == 'push' && !contains(steps.version.outputs.VERSION, 'SNAPSHOT') && endsWith(github.ref, steps.version.outputs.VERSION)"
if: ${{ github.event_name == 'push' && !contains(steps.version.outputs.VERSION, 'SNAPSHOT') && endsWith(github.ref, steps.version.outputs.VERSION) }}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEUSERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEPASSWORD }}
ORG_GRADLE_PROJECT_gumtreeKey: ${{ secrets.GUMTREE_KEY }}
ORG_GRADLE_PROJECT_gumtreeKeyPassphrase: ${{ secrets.GUMTREE_KEY_PASSPHRASE }}
- name: create github release
if: "github.event_name == 'push' && !contains(steps.version.outputs.VERSION, 'SNAPSHOT') && endsWith(github.ref, steps.version.outputs.VERSION)"
if: ${{ github.event_name == 'push' && !contains(steps.version.outputs.VERSION, 'SNAPSHOT') && endsWith(github.ref, steps.version.outputs.VERSION) }}
uses: ncipollo/release-action@v1
with:
artifacts: "dist/build/distributions/gumtree*.zip"
bodyFile: "CHANGELOG.md"
token: ${{ secrets.GITHUB_TOKEN }}
docker:
runs-on: ubuntu-latest
needs: build-test-deploy
if: ${{ !(contains(github.event.head_commit.message, '[no ci]') || startsWith(github.event.head_commit.message, 'doc')) }}
steps:
- name: set up docker buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx
- name: Check secrets presence
- name: check secrets presence
id: checksecrets
shell: bash
run: |
Expand All @@ -92,13 +97,13 @@ jobs:
fi
env:
SECRET: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Docker Hub
- name: login to Docker Hub
uses: docker/login-action@v3
if: (steps.checksecrets.outputs.secretspresent == 'true')
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set Docker Image Tag
- name: set docker image tag
id: set-tag
if: (steps.checksecrets.outputs.secretspresent == 'true')
run: |
Expand All @@ -107,7 +112,7 @@ jobs:
else
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
fi
- name: Build and Push Docker Image
- name: build and push docker image
uses: docker/build-push-action@v5
with:
file: 'docker/Dockerfile'
Expand Down

0 comments on commit b06ad24

Please sign in to comment.