-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add docker ci * update branch
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: docker-ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
|
||
env: | ||
DOCKER_REPOSITORY: edgelevel | ||
DOCKER_IMAGE_NAME: lastpass-operator | ||
|
||
jobs: | ||
docker: | ||
name: Docker | ||
runs-on: ubuntu-latest | ||
# makes sure it doesn't finish the minutes quota if stalls | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# extracts tag from ref, returns semver tag or sha suffix | ||
- name: Get Docker tag | ||
id: get-docker-tag | ||
env: | ||
GITHUB_REF: ${{ github.ref }} | ||
COMMIT_SHA: ${{ github.sha }} | ||
run: | | ||
if [[ ${{ github.ref_type }} == "tag" ]]; then | ||
echo "tag=${GITHUB_REF#refs/tags/v}" >> ${GITHUB_OUTPUT} | ||
else | ||
echo "tag=${COMMIT_SHA:0:7}" >> ${GITHUB_OUTPUT} | ||
fi | ||
- name: Output Docker tag | ||
run: echo ${{ steps.get-docker-tag.outputs.tag }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
# gh-actions-rw | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push [${{ env.DOCKER_IMAGE_NAME }}] | ||
uses: docker/build-push-action@v6 | ||
with: | ||
build-args: | | ||
VERSION_COMMIT=${{ steps.get-docker-tag.outputs.tag }} | ||
# if false it will only build | ||
push: true | ||
tags: | | ||
${{ env.DOCKER_REPOSITORY }}/${{ env.DOCKER_IMAGE_NAME }}:latest | ||
${{ env.DOCKER_REPOSITORY }}/${{ env.DOCKER_IMAGE_NAME }}:${{ steps.get-docker-tag.outputs.tag }} |