[tag] v0.2.45 #217
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: Docker image | |
on: | |
push: | |
workflow_dispatch: | |
repository_dispatch: | |
jobs: | |
docker-image: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- run: docker build -f Dockerfile -t subdirectory/subshell:${{ github.sha }} . | |
name: docker build | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- run: docker push subdirectory/subshell:${{ github.sha }} | |
name: docker push dockerhub sha | |
- run: | | |
docker tag subdirectory/subshell:${{ github.sha }} subdirectory/subshell | |
docker push subdirectory/subshell | |
if: github.ref == 'refs/heads/main' | |
name: docker push dockerhub latest | |
# get git tag | |
# https://github.com/orgs/community/discussions/26686 | |
- run: | | |
docker tag subdirectory/subshell:${{ github.sha }} subdirectory/subshell:${{ github.ref_name }} | |
docker push subdirectory/subshell:${{ github.ref_name }} | |
name: docker push dockerhub tag | |
- name: Login to ghcr | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: | | |
docker tag subdirectory/subshell:${{ github.sha }} ghcr.io/${{ github.actor }}/subshell:${{ github.sha }} | |
docker push ghcr.io/${{ github.actor }}/subshell:${{ github.sha }} | |
name: docker push ghcr sha | |
- run: | | |
docker tag subdirectory/subshell:${{ github.sha }} ghcr.io/${{ github.actor }}/subshell:latest | |
docker push ghcr.io/${{ github.actor }}/subshell:latest | |
if: github.ref == 'refs/heads/main' | |
name: docker push ghcr latest | |
- run: | | |
docker tag subdirectory/subshell:${{ github.sha }} ghcr.io/${{ github.actor }}/subshell:${{ github.ref_name }} | |
docker push ghcr.io/${{ github.actor }}/subshell:${{ github.ref_name }} | |
name: docker push ghcr tag |