mirror of
https://github.com/esauflores/toolbox.git
synced 2026-03-09 21:03:59 +00:00
feat: add base structure for test and push of different toolsets
This commit is contained in:
55
.github/workflows/build-and-push.yml
vendored
55
.github/workflows/build-and-push.yml
vendored
@@ -1,55 +0,0 @@
|
|||||||
name: Build and Push to Personal Registry
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- v*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Install mise
|
|
||||||
run: |
|
|
||||||
curl https://mise.run | sh
|
|
||||||
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
||||||
echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: Install tools via mise
|
|
||||||
run: mise install
|
|
||||||
|
|
||||||
- name: Setup environment
|
|
||||||
run: just setup
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: just test
|
|
||||||
|
|
||||||
|
|
||||||
build-and-push:
|
|
||||||
needs: test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
env:
|
|
||||||
IMAGE: ${{ secrets.REGISTRY_URL }}/dev-tools
|
|
||||||
VERSION: ${{ github.ref_name }}
|
|
||||||
DOCKER_BUILDKIT: 1
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Login to registry
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
registry: ${{ secrets.REGISTRY_URL }}
|
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Build and push image
|
|
||||||
run: |
|
|
||||||
IMAGE_TAG="$IMAGE:$VERSION"
|
|
||||||
docker build -t "$IMAGE_TAG" -t "$IMAGE:latest" .
|
|
||||||
docker push "$IMAGE_TAG"
|
|
||||||
docker push "$IMAGE:latest"
|
|
||||||
60
.github/workflows/test-and-push.yml
vendored
Normal file
60
.github/workflows/test-and-push.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
name: Test and Push To Registry
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
tags: ["v*"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- tools: dev-tools
|
||||||
|
variant: base
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: jdx/mise-action@v3
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: just test ${{ matrix.tools }} ${{ matrix.variant }}
|
||||||
|
|
||||||
|
- name: Cleanup
|
||||||
|
if: always()
|
||||||
|
run: just down-all ${{ matrix.tools }} ${{ matrix.variant }}
|
||||||
|
|
||||||
|
publish:
|
||||||
|
needs: test
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- tools: dev-tools
|
||||||
|
variant: base
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: jdx/mise-action@v3
|
||||||
|
|
||||||
|
- name: Login to registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ secrets.REGISTRY_URL }}
|
||||||
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Push
|
||||||
|
env:
|
||||||
|
REGISTRY_URL: ${{ secrets.REGISTRY_URL }}
|
||||||
|
run: just push ${{ matrix.tools }} ${{ matrix.variant }}
|
||||||
|
|
||||||
|
- name: Cleanup
|
||||||
|
if: always()
|
||||||
|
run: just down-all ${{ matrix.tools }} ${{ matrix.variant }}
|
||||||
Reference in New Issue
Block a user