Skip to content

upgrade actions

upgrade actions #3

Workflow file for this run

name: Build image
on:
push:
branches:
# Matches all branch and tag names that don't contain a slash (/).
- "*"
tags:
# Matches all semantic versioning tags
- v[0-9]+.[0-9]+.[0-9]+
jobs:
docker:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Resolve release name
id: release
run: |
RELEASE_NAME=
GITHUB_REF_STRIPPED=${GITHUB_REF#refs/}
REF_NAME=${GITHUB_REF_STRIPPED##*/}
REF_TYPE=${GITHUB_REF_STRIPPED%/*}
if [[ "$REF_TYPE" == "heads" ]]; then
if [[ "$REF_NAME" == "main" ]]; then
RELEASE_NAME="${GITHUB_SHA}"
else
RELEASE_NAME="$REF_NAME"
fi
elif [[ "$REF_TYPE" == "tags" ]]; then
RELEASE_NAME="${REF_NAME##v}"
fi
echo "Using $RELEASE_NAME as release name."
echo "::set-output name=name::$RELEASE_NAME"
echo "name=$RELEASE_NAME" >> $GITHUB_OUTPUT
# build Go binaries
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.20"
- name: Build
run: go build -o cmd/tesla-http-proxy/tesla-http-proxy ./cmd/tesla-http-proxy
# setup docker
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# build docker image
- name: Build and push docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: |
ghcr.io/nanogreencz/tesla-vehicle-command:${{ steps.release.outputs.name }}