|
| 1 | +name: Create and push dockerfiles |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + latest: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - name: Checkout |
| 12 | + uses: actions/checkout@v4 |
| 13 | + |
| 14 | + - name: Set up Git |
| 15 | + run: | |
| 16 | + git config user.name "${{ github.actor }}" |
| 17 | + git config user.email "${{ github.actor }}@users.noreply.github.com" |
| 18 | +
|
| 19 | + - name: Delete existing latest tag (if exists) |
| 20 | + run: | |
| 21 | + git push --delete origin latest || true |
| 22 | + git tag -d latest || true |
| 23 | + |
| 24 | + - name: Tag Latest Release |
| 25 | + run: | |
| 26 | + # Get the latest release tag |
| 27 | + latest_tag=$(git describe --tags --abbrev=0) |
| 28 | + |
| 29 | + # Get the commit hash of the latest release |
| 30 | + latest_commit=$(git rev-list -n 1 $latest_tag) |
| 31 | + |
| 32 | + # Create a new tag based on the latest commit |
| 33 | + git tag -a latest -m "Latest release" $latest_commit |
| 34 | + |
| 35 | + # Push the new tag to the repository |
| 36 | + git push origin latest |
| 37 | +
|
| 38 | + env: |
| 39 | + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} |
| 40 | + |
| 41 | + - name: Set JAVA_HOME |
| 42 | + run: | |
| 43 | + echo "JAVA_8_HOME=$JAVA_HOME_8_X64" >> $GITHUB_ENV |
| 44 | + echo "JAVA_11_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV |
| 45 | + echo "JAVA_17_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV |
| 46 | + echo "JAVA_HOME=$JAVA_HOME_8_X64" >> $GITHUB_ENV |
| 47 | +
|
| 48 | + - name: Build Project |
| 49 | + run: mvn install -DskipTests=true |
| 50 | + |
| 51 | + - name: Set up QEMU |
| 52 | + uses: docker/setup-qemu-action@v2 |
| 53 | + |
| 54 | + - name: Set up Docker Buildx |
| 55 | + uses: docker/setup-buildx-action@v2 |
| 56 | + |
| 57 | + - name: Build Docker Images |
| 58 | + run: | |
| 59 | + mvn docker:build -pl agent |
| 60 | + mvn docker:build -pl flink |
| 61 | + mvn docker:build -pl hbase/hbase-docker |
| 62 | + mvn verify spring-boot:build-image -DskipTests=true -pl metric-module/collector-starter |
| 63 | + mvn verify spring-boot:build-image -DskipTests=true -pl metric-module/web-starter |
| 64 | + mvn verify spring-boot:build-image -DskipTests=true -pl batch |
| 65 | + mvn verify spring-boot:build-image -DskipTests=true -pl collector |
| 66 | + mvn verify spring-boot:build-image -DskipTests=true -pl web |
| 67 | + docker images |
| 68 | +
|
| 69 | + - name: Log in to Docker Hub |
| 70 | + uses: docker/login-action@v1 |
| 71 | + with: |
| 72 | + username: ${{ secrets.docker_username }} |
| 73 | + password: ${{ secrets.docker_token }} |
| 74 | + |
| 75 | + - name: Push to Docker Hub |
| 76 | + run: | |
| 77 | + docker push --all-tags ${{ secrets.docker_username }}/pinpoint-agent |
| 78 | + docker push --all-tags ${{ secrets.docker_username }}/pinpoint-flink |
| 79 | + docker push --all-tags ${{ secrets.docker_username }}/pinpoint-hbase |
| 80 | + docker push --all-tags ${{ secrets.docker_username }}/pinpoint-batch |
| 81 | + docker push --all-tags ${{ secrets.docker_username }}/pinpoint-collector |
| 82 | + docker push --all-tags ${{ secrets.docker_username }}/pinpoint-web |
| 83 | + |
0 commit comments