From abb95ae05291cca8b644de886da002e4a8342a2e Mon Sep 17 00:00:00 2001 From: H4CK3R-01 <44125287+H4CK3R-01@users.noreply.github.com> Date: Tue, 28 Mar 2023 00:09:56 +0200 Subject: [PATCH] Use Gitea actions instead of drone --- .drone.yml | 27 ------------------------- .gitea/workflows/build.yaml | 40 +++++++++++++++++++++++++++++++++++++ Dockerfile | 4 ++-- 3 files changed, 42 insertions(+), 29 deletions(-) delete mode 100644 .drone.yml create mode 100644 .gitea/workflows/build.yaml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 2bbe8c4..0000000 --- a/.drone.yml +++ /dev/null @@ -1,27 +0,0 @@ -kind: pipeline -type: docker -name: linux-amd64 - -platform: - arch: amd64 - os: linux - -steps: -- name: generate_tag - image: golang - commands: - - echo -n "${DRONE_BRANCH//\//-}-${DRONE_COMMIT_SHA:0:8}, latest" > .tags - - -- name: publish - image: plugins/docker - settings: - username: - from_secret: username - password: - from_secret: password - registry: - from_secret: registry - repo: - from_secret: repo - dockerfile: Dockerfile diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..ef7e950 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,40 @@ +name: Build & Publish +on: [push] +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: https://github.com/docker/metadata-action@v4 + with: + images: git.flokaiser.com/dhbw/pmgame + tags: | + type=sha,enable=true,priority=100,prefix={{branch}}-,suffix=,format=short + type=raw,value=latest,enable={{is_default_branch}} + + - name: Get get-docker.sh + run: curl -fsSL https://get.docker.com -o get-docker.sh + + - name: Install docker + run: sh get-docker.sh + + - name: Login to Registry + uses: docker/login-action@v2 + with: + registry: git.flokaiser.com + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push + uses: docker/build-push-action@v4 + with: + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index b9a84e3..7908570 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,8 +16,8 @@ COPY minimize.sh minimize.sh RUN chmod +x minimize.sh RUN ./minimize.sh RUN sed -i "s/DATE_TO_BE_REPLACED/$(date +%s)/" public/index.html -RUN sed -i "s/COMMIT_TO_BE_REPLACED/GitHub: $(git ls-remote https://github.com/H4CK3R-01/Projektmanagement-Game refs/heads/main | awk '{print $1;}' | cut -c1-7)/" public/index.html -RUN sed -i "s/COMMIT_LINK_TO_BE_REPLACED/https\:\/\/github.com\/H4CK3R-01\/Projektmanagement-Game\/commit\/$(git ls-remote https://github.com/H4CK3R-01/Projektmanagement-Game refs/heads/main | awk '{print $1;}')/" public/index.html +RUN sed -i "s/COMMIT_TO_BE_REPLACED/GitHub: $(git ls-remote https://git.flokaiser.com/DHBW/Projektmanagement-Game refs/heads/main | awk '{print $1;}' | cut -c1-7)/" public/index.html +RUN sed -i "s/COMMIT_LINK_TO_BE_REPLACED/https\:\/\/git.flokaiser.com\/DHBW\/Projektmanagement-Game\/commit\/$(git ls-remote https://git.flokaiser.com/DHBW/Projektmanagement-Game refs/heads/main | awk '{print $1;}')/" public/index.html EXPOSE 5000