name: Gitea Actions Demo run-name: ${{ gitea.actor }} is testing out Gitea Actions ๐Ÿš€ on: [push] jobs: Explore-Gitea-Actions: runs-on: nodejs container: image: node:24-alpine volumes: - /var/data/zApps:/var/data/zApps - /var/data/zUser/apps:/var/data/zUser/apps - /var/data/zApps/bin/docker/docker:/usr/bin/docker steps: - run: echo "GOPATH=/var/data/zUser/apps/go" >> $GITHUB_ENV - run: echo "PATH=/var/data/zApps/bin:/var/data/zUser/apps/node/bin:/var/data/zUser/apps/go/bin:/var/data/zApps/go/bin:$PATH" >> $GITHUB_ENV - run: echo "๐ŸŽ‰ The job was automatically triggered by a ${{ gitea.event_name }} event." - run: echo "๐Ÿง This job is now running on a ${{ runner.os }} server hosted by Gitea!" - run: echo "๐Ÿ”Ž The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - name: Check out repository code uses: https://git.0orz.top/actions/checkout@v6.0.2 with: fetch-depth: 1 - run: echo "๐Ÿ’ก The ${{ gitea.repository }} repository has been cloned to the runner." - run: echo "๐Ÿ–ฅ๏ธ The workflow is now ready to test your code on the runner." - name: List files in the repository run: | ls ${{ gitea.workspace }} - name: Check go version run: | go version - name: Run golangci-lint run: | cd ${{ gitea.workspace }} golangci-lint run ./... - name: Tests run: | cd ${{ gitea.workspace }} go test -cover ./... - name: Go build run: | cd ${{ gitea.workspace }} export CGO_ENABLED=0 go build -ldflags "-X main.version=1.0.0-${{ gitea.sha }}" -o helloapp . - name: Check Docker run: | docker --version - name: Login to Harbor run: | echo "${{ secrets.HARBOR_PASSWORD }}" | docker login localhost:8180 -u "${{ secrets.HARBOR_USERNAME }}" --password-stdin - name: Build Docker image run: | cd ${{ gitea.workspace }} docker build -t localhost:8180/go-example/go-example:${{ gitea.sha }} . - name: Push Docker image to local registry run: | docker push localhost:8180/go-example/go-example:${{ gitea.sha }} - name: Update manifest and Push to Git run: | # ไฝฟ็”จ kustomize ๆˆ– sed ไฟฎๆ”น้•œๅƒ็‰ˆๆœฌ sed -i "s|image: .*:.*|image: localhost:8180/go-example/go-example:${{ gitea.sha }}|g" deployment.yaml # ้…็ฝฎ Git ๅนถๆไบคๅ›žไป“ๅบ“ git config --global user.name "Gitea Action" git config --global user.email "action@gitea.io" git add deployment.yaml git commit -m "chore: update image to ${{ gitea.sha }} [skip ci]" git push origin main - run: echo "๐Ÿ This job's status is ${{ job.status }}."