Skip to content

Commit

Permalink
Push Docker images on release (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
kezhenxu94 committed Apr 25, 2023
1 parent c90e28c commit 4717e1b
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions .github/workflows/publish-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ on:
push:
branches:
- master

env:
HUB: ghcr.io/apache/skywalking-python
PROJECT: skywalking-python
release:
types:
- released

jobs:
build-docker:
Expand All @@ -40,12 +39,31 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- 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
TAG=${{ github.event.release.tag_name }}
echo "TAG=${TAG#v}" >> $GITHUB_ENV
else
echo "HUB=ghcr.io/apache/skywalking" >> $GITHUB_ENV
echo "DOCKER_REGISTRY=ghcr.io/apache/skywalking-python" >> $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 image
run: |
make push-image -j 5
run: make push-image -j 5

0 comments on commit 4717e1b

Please sign in to comment.