Update docker-image.yml

This commit is contained in:
Beeant 2022-06-05 18:31:28 +08:00 committed by GitHub
parent 2726cacd65
commit db0bf2133f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,9 +2,9 @@ name: Docker Image CI
on:
push:
branches: [ main ]
tags:
- '*'
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
@ -13,18 +13,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set version
id: version
run: echo ::set-output name=release_version::${GITHUB_REF#refs/*/}
- name: Build Docker image
run: |
echo Building version ${{ steps.version.outputs.release_version }}...
docker build . --file Dockerfile --tag xbeeant/oo-unlimit:${{ steps.version.outputs.release_version }}
- name: Push Docker image
run: |
echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }}
docker push xbeeant/oo-unlimit:${{ steps.version.outputs.release_version }}
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag xbeeant/oo-unlimit:$(date +%s)
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build image and push to Docker Hub and GitHub Container Registry
uses: docker/build-push-action@v2
with:
# relative path to the place where source code with Dockerfile is located
context: ./
# Note: tags has to be all lower-case
tags: |
xbeeant/devdocs:latest
# build on feature branches, push only on main branch
push: ${{ github.ref == 'refs/heads/main' }}