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