diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e37db64e..5b2a96c9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,16 @@ on: - master jobs: + shellcheck: + if: github.event_name == 'push' + name: Shellcheck + uses: ./.github/workflows/shellcheck.yml + + todo: + if: github.event_name == 'push' + name: TODO + uses: ./.github/workflows/todo.yml + validate-docs: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/docker-dev.yml b/.github/workflows/docker-dev.yml index 4a601e66c..473f40e5d 100644 --- a/.github/workflows/docker-dev.yml +++ b/.github/workflows/docker-dev.yml @@ -17,26 +17,8 @@ on: jobs: docker: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v3 - with: - push: true - file: ./.devcontainer/Dockerfile - tags: ulisesjeremias/vsl_dev:latest - build-args: | - DEV_IMG=true - + uses: ./.github/workflows/docker-publish.yml + with: + tags: ulisesjeremias/vsl:dev + build-args: | + DEV_IMG=true diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 000000000..09ec5259f --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,60 @@ +name: Docker Publish + +concurrency: + group: docker + cancel-in-progress: true + +on: + workflow_call: + inputs: + dockerfile: + description: 'The dockerfile to use' + type: string + required: true + default: './Dockerfile' + context: + description: 'The context to use' + type: string + required: true + default: '.' + build-args: + description: 'The build args to use' + type: string + required: false + default: '' + tags: + description: 'The tags to use' + type: string + required: false + default: '' + secrets: + DOCKERHUB_USERNAME: + description: 'The username to use for the image' + required: true + DOCKERHUB_TOKEN: + description: 'The password to use for the image' + required: true + +jobs: + docker-publish: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + push: true + file: ${{ inputs.dockerfile }} + tags: ${{ inputs.tags }} + build-args: ${{ inputs.build-args }} diff --git a/.github/workflows/docker-stable.yml b/.github/workflows/docker-stable.yml index 637cb7eaa..3742505db 100644 --- a/.github/workflows/docker-stable.yml +++ b/.github/workflows/docker-stable.yml @@ -11,45 +11,21 @@ on: jobs: docker-latest: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + uses: ./.github/workflows/docker-publish.yml + with: + tags: ulisesjeremias/vsl:latest + build-args: | + DEV_IMG=false - - name: Build and push - uses: docker/build-push-action@v3 - with: - push: true - tags: ulisesjeremias/vsl:latest docker-tag: runs-on: ubuntu-latest steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Extract Git Tag run: echo "GIT_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - - name: Build and push - uses: docker/build-push-action@v3 + - name: Docker Publish + uses: ./.github/workflows/docker-publish.yml with: - push: true tags: ulisesjeremias/vsl:${{ env.GIT_TAG }} + build-args: | + DEV_IMG=false diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 000000000..d1bd05999 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,14 @@ +name: Shellcheck + +on: + workflow_call: + +jobs: + shellcheck: + name: Shellcheck + runs-on: ubuntu-latest + steps: + - name: Begin CI... + uses: actions/checkout@v3 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@1.1.0 diff --git a/.github/workflows/todo.yml b/.github/workflows/todo.yml index 61b1a8d17..6b027e89a 100644 --- a/.github/workflows/todo.yml +++ b/.github/workflows/todo.yml @@ -1,9 +1,7 @@ name: Todo Checker on: - push: - branches: - - master + workflow_call: jobs: todo: