diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 8379d9e..ab911e7 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,59 +1,48 @@ - -name: CI +name: Build and Push Docker Image on: push: - branches: [ main ] + branches: [ main, master ] pull_request: - branches: [ main ] + branches: [ main, master ] jobs: - build: + build-and-push: runs-on: ubuntu-latest steps: - name: Install system Dependencies run: | apt-get update && apt-get install -y curl jq docker.io - - name: Set up Docker + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Checkout code uses: actions/checkout@v4 - - name: Set up Node.js - uses: actions/setup-node@v4 + - name: Log in to Gitea Container Registry + uses: docker/login-action@v3 with: - node-version: 18 + registry: gitea.portal.tulsacounty.org + username: ${{ gitea.actor }} + password: ${{ secrets.REGISTRY_TOKEN }} - - name: Install NPM dependencies - run: npm install + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: gitea.portal.tulsacounty.org/${{ gitea.repository }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=raw,value=latest,enable={{is_default_branch}} + type=sha,prefix={{branch}}- - - name: Lint (if ESLint is configured) - run: | - if [ -f .eslintrc.js ] || [ -f .eslintrc.json ] || [ -f .eslintrc ]; then - npx eslint . - else - echo "No ESLint config found, skipping lint." - fi - - # - name: Run tests (uncomment if you add tests) - # run: npm test - - - name: Set Docker image tag - id: vars - run: | - TAG=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD) - echo "tag=$TAG" >> $GITHUB_OUTPUT - - - name: Build Docker image - run: | - docker build -t pictshare-browse:${{ steps.vars.outputs.tag }} -t pictshare-browse:latest . - - - name: Push Docker image - run: | - echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin - docker tag pictshare-browse:${{ steps.vars.outputs.tag }} ryanehamil/pictshare-browse:${{ steps.vars.outputs.tag }} - docker tag pictshare-browse:latest ryanehamil/pictshare-browse:latest - docker push ryanehamil/pictshare-browse:${{ steps.vars.outputs.tag }} - docker push ryanehamil/pictshare-browse:latest + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}