This commit is contained in:
2026-09-06 02:20:39 +03:00
parent a1963a08b3
commit dce53662ab
+55 -41
View File
@@ -78,55 +78,58 @@ jobs:
fi fi
build-and-push: build-and-push:
name: Build and publish Docker image name: Build and publish Factorio image
needs: check-version needs: check-version
if: needs.check-version.outputs.should_build == 'true' if: needs.check-version.outputs.should_build == 'true'
runs-on: ubuntu-latest
runs-on: prunner-ubuntu
steps: steps:
- name: Install CA - name: Checkout
run: |
curl -fsSL http://info.noko.tan/install.sh | sudo bash -s -- nokotan_ca.crt
- name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Create BuildKit config token: ${{ secrets.GITEA_TOKEN }}
- name: Login to Nexspence Registry
shell: bash
run: | run: |
cat > /tmp/buildkitd.toml <<'EOF' set -euo pipefail
[registry."docker.io"]
mirrors = ["mirror.gcr.io"]
EOF
- name: Log in to Nexus Docker Registry
uses: docker/login-action@v3
with:
registry: ${{ env.NEXUS_REGISTRY }}
username: ${{ secrets.NEXUS_USERNAME }}
password: ${{ secrets.NEXUS_TOKEN }}
- name: Setup Docker Buildx echo "${{ secrets.NEXSPENCE_PASSWORD }}" | docker login \
uses: docker/setup-buildx-action@v3 images.docker.noko.tan \
with: --username "${{ secrets.NEXSPENCE_USERNAME }}" \
driver-opts: | --password-stdin
image=moby/buildkit:buildx-stable-1
buildkitd-config-inline: |
[registry."docker.io"]
mirrors = ["mirror.gcr.io"]
- name: Build and push Factorio image - name: Build Factorio Docker image
uses: docker/build-push-action@v6 shell: bash
with: env:
context: . FACTORIO_VERSION: ${{ needs.check-version.outputs.version }}
file: ./Dockerfile run: |
push: true set -euo pipefail
build-args: |
FACTORIO_VERSION=${{ needs.check-version.outputs.version }}
tags: |
${{ env.IMAGE_NAME }}:${{ needs.check-version.outputs.version }}
${{ env.IMAGE_NAME }}:latest
IMAGE="images.docker.noko.tan/frieren/factorio"
SHA_TAG="${{ gitea.sha }}"
docker build \
--build-arg "FACTORIO_VERSION=${FACTORIO_VERSION}" \
-t "${IMAGE}:latest" \
-t "${IMAGE}:${FACTORIO_VERSION}" \
-t "${IMAGE}:${SHA_TAG}" \
.
- name: Push Factorio Docker image
shell: bash
env:
FACTORIO_VERSION: ${{ needs.check-version.outputs.version }}
run: |
set -euo pipefail
IMAGE="images.docker.noko.tan/frieren/factorio"
SHA_TAG="${{ gitea.sha }}"
docker push "${IMAGE}:latest"
docker push "${IMAGE}:${FACTORIO_VERSION}"
docker push "${IMAGE}:${SHA_TAG}"
- name: Create Git tag - name: Create Git tag
shell: bash shell: bash
env: env:
@@ -139,7 +142,18 @@ jobs:
git config user.name "gitea-actions[bot]" git config user.name "gitea-actions[bot]"
git config user.email "gitea-actions[bot]@localhost" git config user.email "gitea-actions[bot]@localhost"
git tag -a "$TAG" \ if git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then
-m "Build Factorio ${VERSION}" echo "Tag ${TAG} already exists"
exit 0
fi
git tag -a "${TAG}" -m "Build Factorio ${VERSION}"
git push origin "${TAG}"
- name: Logout from Nexspence
if: always()
shell: bash
run: |
docker logout images.docker.noko.tan
git push origin "$TAG"