name: CI on: pull_request: push: branches: - main tags: - 'v*' env: REGISTRY: gitea.reversed.dev IMAGE_NAME: space/evil-wordle jobs: test: name: Lint and build app runs-on: ubuntu-latest steps: - name: Check out repository uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: 22 cache: npm - name: Install dependencies run: npm ci - name: Lint run: npm run lint - name: Build app run: npm run build - name: Validate compose file run: docker compose config publish-image: name: Publish container image runs-on: ubuntu-latest needs: test if: ${{ github.event_name == 'push' }} steps: - name: Check out repository uses: actions/checkout@v4 - name: Log in to Gitea registry run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY" -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin - name: Build image run: | SHORT_SHA="${GITHUB_SHA::12}" docker build \ --tag "$REGISTRY/$IMAGE_NAME:latest" \ --tag "$REGISTRY/$IMAGE_NAME:$SHORT_SHA" \ . - name: Push image run: | SHORT_SHA="${GITHUB_SHA::12}" docker push "$REGISTRY/$IMAGE_NAME:latest" docker push "$REGISTRY/$IMAGE_NAME:$SHORT_SHA"