test: test github action #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish to DockerHub | |
on: | |
push: | |
release: | |
types: [published] | |
jobs: | |
publish-alpine: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/releases/') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Docker Login - Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Create Release tag | |
run: | | |
echo "bcliang/docker-libgourou" > BE_NAME | |
echo "${GITHUB_REF#refs/tags/releases/}-alpine" > RELEASE_TAG | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile-alpine --tag $(cat BE_NAME):$(cat RELEASE_TAG) | |
- name: Tag to release (-alpine) | |
run: | | |
docker tag $(cat BE_NAME):$(cat RELEASE_TAG) | |
# - name: Push container to dockerhub | |
# run: docker push --all-tags $(cat BE_NAME) | |
publish-ubuntu: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/releases/') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Docker Login - Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Create Release tag | |
run: | | |
echo "bcliang/docker-libgourou" > BE_NAME | |
echo "${GITHUB_REF#refs/tags/releases/}-ubuntu" > RELEASE_TAG | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile-ubuntu --tag $(cat BE_NAME):$(cat RELEASE_TAG) | |
- name: Tag to release (-ubuntu) + latest | |
run: | | |
docker tag $(cat BE_NAME):$(cat RELEASE_TAG) $(cat BE_NAME):latest | |
# - name: Push container to dockerhub | |
# run: docker push --all-tags $(cat BE_NAME) |