Improve docs and error message on /drip #173
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" | |
pull_request: | |
branches: | |
- "master" | |
jobs: | |
all: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
repository: sharat87/httpbun | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.mod | |
- name: Get task | |
run: | | |
curl --silent --show-error --location 'https://github.com/go-task/task/releases/download/v3.29.1/task_linux_amd64.tar.gz' \ | |
| tar -xzf - -C /usr/local/bin task | |
- name: Test | |
run: task test | |
- name: Build binaries | |
run: task docker | |
- name: Build and Push Docker images to GHCR and DockerHub | |
if: | | |
success() && github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: | | |
docker buildx create --use | |
tag_name="$(echo "${{ github.ref_name }}" | sed 's/^master$/latest/')" | |
declare -a tags | |
tags+=(--tag "${{ vars.DOCKER_HUB_USERNAME }}/httpbun:$tag_name") | |
tags+=(--tag "ghcr.io/${{ github.actor }}/httpbun:$tag_name") | |
if [[ "$tag_name" == latest ]]; then | |
tags+=(--tag "${{ vars.DOCKER_HUB_USERNAME }}/httpbun:${{ github.sha }}") | |
fi | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io --username "${{ github.actor }}" --password-stdin | |
echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login --username "${{ vars.DOCKER_HUB_USERNAME }}" --password-stdin | |
docker buildx build --platform linux/amd64,linux/arm64 --push "${tags[@]}" . |