diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index a520f02..0000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: Build image - -on: - - push - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - - name: Install uv - uses: astral-sh/setup-uv@v7 - with: - enable-cache: true - - - name: Install deps - run: make install-dev - - - name: Run codegen - run: make gen - - - name: Set up Docker runtime - uses: docker/setup-buildx-action@v3 - - - name: Build image - uses: docker/build-push-action@v6 - with: - context: . - load: true - push: false - tags: local/test-image:latest - - - name: Run image help - run: docker run --rm --entrypoint "${{ github.event.repository.name }}" local/test-image:latest --help diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..aaca8ca --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,103 @@ +name: CI + +on: + push: + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + enable-cache: true + + - name: Install deps + run: make install-dev + + - name: Run codegen + run: make gen + + - name: Run checks + run: make check + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Install uv + uses: astral-sh/setup-uv@v7 + + - name: Install deps + run: make install-dev + + - name: Run codegen + run: make gen + + - name: Set up Docker runtime + uses: docker/setup-buildx-action@v3 + + - name: Build image + uses: docker/build-push-action@v6 + with: + context: . + load: true + push: false + tags: local/app:latest + + - name: Run image help + run: docker run --rm --entrypoint "uploader" local/app:latest --help + + - name: Save image + run: docker save local/app:latest -o image.tar + + - name: Upload image + uses: actions/upload-artifact@v4 + with: + name: docker-image + path: image.tar + retention-days: 1 + + release: + runs-on: ubuntu-latest + needs: [tests, build] + if: github.ref_name == github.event.repository.default_branch + permissions: + contents: read + packages: write + steps: + - name: Download image + uses: actions/download-artifact@v4 + with: + name: docker-image + + - name: Set up Docker runtime + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Load image + run: docker load -i image.tar + + - name: Set image name + run: echo "IMAGE_NAME=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV" + + - name: Set short SHA + run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> "$GITHUB_ENV" + + - name: Push image + run: | + + docker tag local/app:latest ${{ env.IMAGE_NAME }}:${{ env.SHORT_SHA }} + docker tag local/app:latest ${{ env.IMAGE_NAME }}:latest + docker push ${{ env.IMAGE_NAME }}:${{ env.SHORT_SHA }} + docker push ${{ env.IMAGE_NAME }}:latest + diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 076d80d..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: Release image - -on: - workflow_dispatch: - -jobs: - release: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v6 - - - name: Install uv - uses: astral-sh/setup-uv@v7 - with: - enable-cache: true - - - name: Install deps - run: make install-dev - - - name: Run codegen - run: make gen - - - name: Set up Docker runtime - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Set image name - run: echo "IMAGE_NAME=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV" - - - name: Set short SHA - run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> "$GITHUB_ENV" - - - name: Build and push image - uses: docker/build-push-action@v6 - with: - context: . - push: true - tags: | - ${{ env.IMAGE_NAME }}:${{ env.SHORT_SHA }} - ${{ env.IMAGE_NAME }}:latest diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml deleted file mode 100644 index ac6270f..0000000 --- a/.github/workflows/tests.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: "[backend] Static checks & tests" - -on: - - push - -jobs: - tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - - name: Install uv - uses: astral-sh/setup-uv@v7 - with: - enable-cache: true - - - name: Install deps - run: make install-dev - - - name: Run codegen - run: make gen - - - name: Run checks - run: make check diff --git a/.template.yaml b/.template.yaml index 16a406a..88ddb51 100644 --- a/.template.yaml +++ b/.template.yaml @@ -1,6 +1,6 @@ # Autogenerated - DO NOT EDIT # Parameters of the project as generated from template -_commit: dcba0b0 +_commit: 6b97e37 _src_path: gh:kraysent/python-template package_name: uploader project_name: uploader