This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
Docker images #292
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 images | |
on: | |
workflow_run: | |
workflows: ["CI"] | |
types: | |
- completed | |
jobs: | |
main: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: "1.18" | |
- name: Install Zig | |
run: | | |
sudo apt install xz-utils | |
sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.10.0-dev.2439+c84f5a5f9.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' | |
- name: Install Task | |
uses: arduino/setup-task@v1 | |
- name: Build Docker image | |
run: | | |
task setup | |
task build-image | |
- name: Record latest release version | |
id: recorded_release_version | |
run: echo "::set-output name=commit::$(git log --oneline | head -n1 | cut -d " " -f1)" | |
- name: Publish Docker image | |
if: success() && github.ref == 'refs/heads/main' && github.repository == 'sourcegraph/doctree' | |
run: | | |
export RELEASE_NAME="$(date --rfc-3339=date)-$RELEASE_COMMIT" | |
echo "$DOCKER_PASSWORD" | docker login -u="$DOCKER_USERNAME" --password-stdin | |
docker tag "sourcegraph/doctree:dev" "sourcegraph/doctree:$RELEASE_NAME" | |
docker push "sourcegraph/doctree:$RELEASE_NAME" | |
docker tag "sourcegraph/doctree:dev" "sourcegraph/doctree:latest" | |
docker push "sourcegraph/doctree:latest" | |
env: | |
RELEASE_COMMIT: ${{steps.recorded_release_version.outputs.commit}} | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} |