feat: add imagerunner services (#839) #110
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: Docker release | |
on: | |
push: | |
tags: | |
- v* | |
jobs: | |
# Build the project as a Docker image and push it to Docker Hub | |
push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
outputs: | |
tags: ${{ steps.meta.outputs.tags }} | |
label: ${{ steps.meta.outputs.labels }} | |
version: ${{ steps.set_version.outputs.version }} | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Set Release Version | |
id: set_version | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
- name: Check Docker Version | |
run: docker --version | |
- name: Check Release Version | |
run: echo ${{ env.RELEASE_VERSION }} | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: saucelabs/saucectl | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
env: | |
LD_1: -X 'github.com/saucelabs/saucectl/internal/version.Version=${{ env.RELEASE_VERSION }}' | |
LD_2: -X 'github.com/saucelabs/saucectl/internal/version.GitCommit=${{ github.sha }}' | |
LD_3: -X 'github.com/saucelabs/saucectl/internal/setup.SegmentWriteKey=${{ secrets.SEGMENT_WRITE_KEY }}' | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: LD_FLAGS=${{ env.LD_1 }} ${{ env.LD_2 }} ${{ env.LD_3 }} ${{ env.LD_4 }} ${{ env.LD_5 }} | |
smoke_test_image: | |
name: Smoke test Docker image | |
runs-on: ubuntu-latest | |
container: saucelabs/saucectl:${{ needs.push_to_registry.outputs.version }} | |
needs: push_to_registry | |
steps: | |
- name: Verify saucectl | |
run: saucectl --version |