Publish Docker images on official release (#10508)

This commit is contained in:
kezhenxu94 2023-03-08 21:50:59 +08:00 committed by GitHub
parent 1c644ba624
commit 91991ab87e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 10 deletions

View File

@ -20,10 +20,12 @@ on:
push:
branches:
- master
release:
types:
- released
env:
SKIP_TEST: true
HUB: ghcr.io/apache/skywalking
jobs:
build:
@ -33,8 +35,6 @@ jobs:
contents: read
packages: write
timeout-minutes: 90
env:
TAG: ${{ github.sha }}
steps:
- uses: actions/checkout@v3
with:
@ -46,20 +46,37 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set environment variables
run: |
if [[ ${{ github.event_name }} == "release" ]]; then
echo "HUB=apache" >> $GITHUB_ENV
echo "DOCKER_REGISTRY=docker.io" >> $GITHUB_ENV
echo "DOCKER_USERNAME=${{ secrets.DOCKERHUB_USER }}" >> $GITHUB_ENV
echo "DOCKER_PASSWORD=${{ secrets.DOCKERHUB_TOKEN }}" >> $GITHUB_ENV
echo "OAP_NAME=skywalking-oap-server" >> $GITHUB_ENV
echo "UI_NAME=skywalking-ui" >> $GITHUB_ENV
echo "TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
else
echo "HUB=ghcr.io/apache/skywalking" >> $GITHUB_ENV
echo "DOCKER_REGISTRY=ghcr.io/apache/skywalking" >> $GITHUB_ENV
echo "DOCKER_USERNAME=${{ github.actor }}" >> $GITHUB_ENV
echo "DOCKER_PASSWORD=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
echo "TAG=${{ github.sha }}" >> $GITHUB_ENV
fi
- name: Log in to the Container registry
uses: docker/login-action@v1.10.0
uses: docker/login-action@v2
with:
registry: ${{ env.HUB }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push docker images
run: make build.all docker.push
- name: Build and push docker images based on Java 17
env:
SW_OAP_BASE_IMAGE: eclipse-temurin:17-jre
TAG: ${{ github.sha }}-java17
TAG: ${{ env.TAG }}-java17
run: make build.all docker.push
- name: Build and push docker images
run: make build.all docker.push push.docker.data-generator

View File

@ -282,6 +282,10 @@ SkyWalking Resources:
## Publish the Docker images
We have a [GitHub workflow](../../../.github/workflows/publish-docker.yaml) to automatically publish the Docker images to
Docker Hub after you set the version from `pre-release` to `release`, all you need to do is to watch that workflow and see
whether it succeeds, if it fails, you can use the following steps to publish the Docker images in your local machine.
```shell
export SW_VERSION=x.y.z
git clone --depth 1 --branch v$SW_VERSION https://github.com/apache/skywalking.git