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: Workflow for building API, testing, lint, build docker Image and pushing it to Docker Hub | |
on: | |
push: | |
branches: | |
- main | |
- milestone-* | |
pull_request: | |
types: [opened] | |
branches: | |
- milestone-* | |
jobs: | |
CI: | |
name: Set | |
runs-on: self-hosted | |
permissions: | |
packages: write | |
contents: read | |
attestations: write | |
id-token: write | |
steps: | |
- name: pull code | |
uses: actions/checkout@v4 | |
- name: Build and Test | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.14" | |
- run: make ci | |
- run: make test | |
- run: make lint | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{secrets.DOCKER_USERNAME}} | |
password: ${{secrets.DOCKER_PASSSWORD}} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ${{secrets.DOCKER_USERNAME}}/sre-bootcamp-web-server | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |