Merge pull request 'feat: Implement GitHub Actions Workflows for CI/CD' (#1) from feature/ci-setup into main
Reviewed-on: #1
This commit was merged in pull request #1.
	This commit is contained in:
		@@ -1,54 +0,0 @@
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
      - main
 | 
			
		||||
  release:
 | 
			
		||||
    types:
 | 
			
		||||
      - published
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build-deploy:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    env: 
 | 
			
		||||
      DOCKER_LATEST: nightly
 | 
			
		||||
      DOCKER_ORG: beisel.org
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout Code
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
 | 
			
		||||
      - name: Setup Docker
 | 
			
		||||
        run: curl -fsSL https://get.docker.com | sh
 | 
			
		||||
 | 
			
		||||
      - name: Setup Docker BuildX
 | 
			
		||||
        uses: docker/setup-buildx-action@v2
 | 
			
		||||
        with:
 | 
			
		||||
          config-inline: |
 | 
			
		||||
            [registry."https://git.beisel.it"]
 | 
			
		||||
 | 
			
		||||
      - name: Login to Registry
 | 
			
		||||
        uses: docker/login-action@v2
 | 
			
		||||
        with:
 | 
			
		||||
          registry: git.beisel.it # replace it with your local IP
 | 
			
		||||
          username: ${{ gitea.actor }}
 | 
			
		||||
          password: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
 | 
			
		||||
 | 
			
		||||
      - name: Get Meta
 | 
			
		||||
        id: meta
 | 
			
		||||
        run: |
 | 
			
		||||
          echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
 | 
			
		||||
          echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT   
 | 
			
		||||
 | 
			
		||||
      - name: Build and push
 | 
			
		||||
        uses: docker/build-push-action@v4
 | 
			
		||||
        with:
 | 
			
		||||
          context: .
 | 
			
		||||
          file: ./Dockerfile
 | 
			
		||||
          platforms: |
 | 
			
		||||
            linux/amd64
 | 
			
		||||
            linux/arm64                        
 | 
			
		||||
          push: true
 | 
			
		||||
          tags: | # replace it with your local IP and tags
 | 
			
		||||
            git.beisel.it/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
 | 
			
		||||
            git.beisel.it/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										95
									
								
								.gitea/workflows/publish-nightly.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								.gitea/workflows/publish-nightly.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,95 @@
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
      - main
 | 
			
		||||
      
 | 
			
		||||
jobs:
 | 
			
		||||
  build-deploy:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    env: 
 | 
			
		||||
      DOCKER_LATEST: nightly
 | 
			
		||||
      DOCKER_ORG: beisel.org
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout Code
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
 | 
			
		||||
      - name: Setup Docker
 | 
			
		||||
        run: curl -fsSL https://get.docker.com | sh
 | 
			
		||||
 | 
			
		||||
      - name: Setup Docker BuildX
 | 
			
		||||
        uses: docker/setup-buildx-action@v2
 | 
			
		||||
        with:
 | 
			
		||||
          config-inline: |
 | 
			
		||||
            [registry."https://git.beisel.it"]            
 | 
			
		||||
 | 
			
		||||
      - name: Login to Registry
 | 
			
		||||
        uses: docker/login-action@v2
 | 
			
		||||
        with:
 | 
			
		||||
          registry: git.beisel.it # replace it with your local IP
 | 
			
		||||
          username: ${{ gitea.actor }}
 | 
			
		||||
          password: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
 | 
			
		||||
 | 
			
		||||
      - name: Get Meta
 | 
			
		||||
        id: meta
 | 
			
		||||
        run: |
 | 
			
		||||
          echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
 | 
			
		||||
          echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT             
 | 
			
		||||
 | 
			
		||||
      - name: build-docker
 | 
			
		||||
        uses: docker/build-push-action@v4
 | 
			
		||||
        with:
 | 
			
		||||
          context: .
 | 
			
		||||
          file: ./Dockerfile
 | 
			
		||||
          platforms: |
 | 
			
		||||
            linux/amd64
 | 
			
		||||
            linux/arm64                                    
 | 
			
		||||
          push: true
 | 
			
		||||
          tags: | # replace it with your local IP and tags
 | 
			
		||||
            git.beisel.it/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
 | 
			
		||||
            git.beisel.it/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}
 | 
			
		||||
      
 | 
			
		||||
      - name: Set up Go
 | 
			
		||||
        uses: actions/setup-go@v2
 | 
			
		||||
        with:
 | 
			
		||||
          go-version: '1.21' # Specify your Go version
 | 
			
		||||
 | 
			
		||||
      - name: Build the Binary Version for Linux
 | 
			
		||||
        run: go build -ldflags="-s -w -X 'main.Version=${{  github.ref_name }}'" -o bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-linux-amd64
 | 
			
		||||
 | 
			
		||||
      - name: Build the Binary Version for Windows
 | 
			
		||||
        run: GOOS=windows GOARCH=amd64 go build -ldflags="-s -w -X 'main.Version=${{  github.ref_name }}'" -o bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-windows-amd64.exe
 | 
			
		||||
 | 
			
		||||
      - name: Build the Binary Version for MacOS
 | 
			
		||||
        run: GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -X 'main.Version=${{  github.ref_name }}'" -o bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-darwin-amd64
 | 
			
		||||
 | 
			
		||||
      - name: Upload a build tagged with the gitref
 | 
			
		||||
        run: |
 | 
			
		||||
          curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} \
 | 
			
		||||
          --upload-file bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-linux-amd64 \
 | 
			
		||||
          https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ steps.meta.outputs.REPO_VERSION }}/${{ steps.meta.outputs.REPO_NAME }}-${{ github.ref_name }}-linux-amd64
 | 
			
		||||
          
 | 
			
		||||
          curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} \
 | 
			
		||||
          --upload-file bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-windows-amd64.exe \
 | 
			
		||||
          https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ steps.meta.outputs.REPO_VERSION }}/${{ steps.meta.outputs.REPO_NAME }}-${{ github.ref_name }}-windows-amd64.exe
 | 
			
		||||
 | 
			
		||||
          curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} \
 | 
			
		||||
          --upload-file bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-darwin-amd64 \
 | 
			
		||||
          https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ steps.meta.outputs.REPO_VERSION }}/${{ steps.meta.outputs.REPO_NAME }}-${{ github.ref_name }}-darwin-amd64          
 | 
			
		||||
 | 
			
		||||
      - name: Delete nightly from generic package registry
 | 
			
		||||
        run: curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} -X DELETE https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ env.DOCKER_LATEST }}
 | 
			
		||||
 | 
			
		||||
      - name: upload nightly
 | 
			
		||||
        run: |
 | 
			
		||||
          curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} \
 | 
			
		||||
          --upload-file bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-linux-amd64 \
 | 
			
		||||
          https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ env.DOCKER_LATEST }}/${{ steps.meta.outputs.REPO_NAME }}-${{ env.DOCKER_LATEST }}-linux-amd64
 | 
			
		||||
          
 | 
			
		||||
          curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} \
 | 
			
		||||
          --upload-file bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-windows-amd64.exe \
 | 
			
		||||
          https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ env.DOCKER_LATEST }}/${{ steps.meta.outputs.REPO_NAME }}-${{ env.DOCKER_LATEST }}-windows-amd64.exe
 | 
			
		||||
 | 
			
		||||
          curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} \
 | 
			
		||||
          --upload-file bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-darwin-amd64 \
 | 
			
		||||
          https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ env.DOCKER_LATEST }}/${{ steps.meta.outputs.REPO_NAME }}-${{ env.DOCKER_LATEST }}-darwin-amd64          
 | 
			
		||||
							
								
								
									
										97
									
								
								.gitea/workflows/publish-release.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								.gitea/workflows/publish-release.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,97 @@
 | 
			
		||||
name: New Release Workflow
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  release:
 | 
			
		||||
    types: 
 | 
			
		||||
      - published
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build-deploy:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    env: 
 | 
			
		||||
      DOCKER_LATEST: latest
 | 
			
		||||
      DOCKER_ORG: beisel.org
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: Checkout Code
 | 
			
		||||
        uses: actions/checkout@v4
 | 
			
		||||
 | 
			
		||||
      - name: Setup Docker
 | 
			
		||||
        run: curl -fsSL https://get.docker.com | sh
 | 
			
		||||
 | 
			
		||||
      - name: Setup Docker BuildX
 | 
			
		||||
        uses: docker/setup-buildx-action@v2
 | 
			
		||||
        with:
 | 
			
		||||
          config-inline: |
 | 
			
		||||
            [registry."https://git.beisel.it"]            
 | 
			
		||||
 | 
			
		||||
      - name: Login to Registry
 | 
			
		||||
        uses: docker/login-action@v2
 | 
			
		||||
        with:
 | 
			
		||||
          registry: git.beisel.it # replace it with your local IP
 | 
			
		||||
          username: ${{ gitea.actor }}
 | 
			
		||||
          password: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
 | 
			
		||||
 | 
			
		||||
      - name: Get Meta
 | 
			
		||||
        id: meta
 | 
			
		||||
        run: |
 | 
			
		||||
          echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
 | 
			
		||||
          echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT             
 | 
			
		||||
 | 
			
		||||
      - name: build-docker
 | 
			
		||||
        uses: docker/build-push-action@v4
 | 
			
		||||
        with:
 | 
			
		||||
          context: .
 | 
			
		||||
          file: ./Dockerfile
 | 
			
		||||
          platforms: |
 | 
			
		||||
            linux/amd64
 | 
			
		||||
            linux/arm64                                    
 | 
			
		||||
          push: true
 | 
			
		||||
          tags: | # replace it with your local IP and tags
 | 
			
		||||
            git.beisel.it/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
 | 
			
		||||
            git.beisel.it/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}
 | 
			
		||||
      
 | 
			
		||||
      - name: Set up Go
 | 
			
		||||
        uses: actions/setup-go@v2
 | 
			
		||||
        with:
 | 
			
		||||
          go-version: '1.21' # Specify your Go version
 | 
			
		||||
 | 
			
		||||
      - name: Build the Binary Version for Linux
 | 
			
		||||
        run: go build -ldflags="-s -w -X 'main.Version=${{  github.ref_name }}'" -o bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-linux-amd64
 | 
			
		||||
 | 
			
		||||
      - name: Build the Binary Version for Windows
 | 
			
		||||
        run: GOOS=windows GOARCH=amd64 go build -ldflags="-s -w -X 'main.Version=${{  github.ref_name }}'" -o bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-windows-amd64.exe
 | 
			
		||||
 | 
			
		||||
      - name: Build the Binary Version for MacOS
 | 
			
		||||
        run: GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -X 'main.Version=${{  github.ref_name }}'" -o bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-darwin-amd64
 | 
			
		||||
 | 
			
		||||
      - name: Upload a build tagged with the gitref
 | 
			
		||||
        run: |
 | 
			
		||||
          curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} \
 | 
			
		||||
          --upload-file bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-linux-amd64 \
 | 
			
		||||
          https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ steps.meta.outputs.REPO_VERSION }}/${{ steps.meta.outputs.REPO_NAME }}-${{ github.ref_name }}-linux-amd64
 | 
			
		||||
          
 | 
			
		||||
          curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} \
 | 
			
		||||
          --upload-file bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-windows-amd64.exe \
 | 
			
		||||
          https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ steps.meta.outputs.REPO_VERSION }}/${{ steps.meta.outputs.REPO_NAME }}-${{ github.ref_name }}-windows-amd64.exe
 | 
			
		||||
 | 
			
		||||
          curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} \
 | 
			
		||||
          --upload-file bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-darwin-amd64 \
 | 
			
		||||
          https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ steps.meta.outputs.REPO_VERSION }}/${{ steps.meta.outputs.REPO_NAME }}-${{ github.ref_name }}-darwin-amd64          
 | 
			
		||||
 | 
			
		||||
      - name: Delete latest from generic package registry
 | 
			
		||||
        run: curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} -X DELETE https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ env.DOCKER_LATEST }}
 | 
			
		||||
 | 
			
		||||
      - name: upload latest
 | 
			
		||||
        run: |
 | 
			
		||||
          curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} \
 | 
			
		||||
          --upload-file bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-linux-amd64 \
 | 
			
		||||
          https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ env.DOCKER_LATEST }}/${{ steps.meta.outputs.REPO_NAME }}-${{ env.DOCKER_LATEST }}-linux-amd64
 | 
			
		||||
          
 | 
			
		||||
          curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} \
 | 
			
		||||
          --upload-file bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-windows-amd64.exe \
 | 
			
		||||
          https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ env.DOCKER_LATEST }}/${{ steps.meta.outputs.REPO_NAME }}-${{ env.DOCKER_LATEST }}-windows-amd64.exe
 | 
			
		||||
 | 
			
		||||
          curl --user ${{gitea.actor}}:${{ secrets.PERSONAL_ACCESS_TOKEN }} \
 | 
			
		||||
          --upload-file bin/${{ steps.meta.outputs.REPO_NAME }}-${{  github.ref_name }}-darwin-amd64 \
 | 
			
		||||
          https://git.beisel.it/api/packages/${{ env.DOCKER_ORG }}/generic/${{ steps.meta.outputs.REPO_NAME }}/${{ env.DOCKER_LATEST }}/${{ steps.meta.outputs.REPO_NAME }}-${{ env.DOCKER_LATEST }}-darwin-amd64          
 | 
			
		||||
							
								
								
									
										20
									
								
								.gitea/workflows/test-commits.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								.gitea/workflows/test-commits.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
name: Test Changes on Push
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build-vet-test:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - uses: actions/checkout@v2
 | 
			
		||||
    - name: Set up Go
 | 
			
		||||
      uses: actions/setup-go@v2
 | 
			
		||||
      with:
 | 
			
		||||
        go-version: '1.21' # Specify your Go version
 | 
			
		||||
    - name: Build
 | 
			
		||||
      run: go build ./...
 | 
			
		||||
    - name: Vet
 | 
			
		||||
      run: go vet ./...
 | 
			
		||||
    - name: Test
 | 
			
		||||
      run: go test ./...
 | 
			
		||||
		Reference in New Issue
	
	Block a user