Update README.md #111
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: Publish | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "master" | |
release: | |
types: | |
- published | |
pull_request: | |
branches: | |
- "master" | |
jobs: | |
all: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18.3 | |
- name: Test | |
run: make test | |
- name: Build | |
run: make build-for-prod build-for-docker | |
- name: Push Docker images to GHCR | |
if: | | |
success() && github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: | | |
tag="${{ github.ref_name }}" | |
docker build -t im -t "ghcr.io/${{ github.actor }}/httpbun:$tag" . | |
if [[ $tag == master ]]; then | |
docker tag im "ghcr.io/${{ github.actor }}/httpbun:latest" | |
docker tag im "ghcr.io/${{ github.actor }}/httpbun:${{ github.sha }}" | |
fi | |
docker login ghcr.io --username "${{ github.actor }}" --password "${{ secrets.GITHUB_TOKEN }}" | |
docker push --all-tags "ghcr.io/${{ github.actor }}/httpbun" |