build: use go install
This commit is contained in:
		
							parent
							
								
									b7f4d06731
								
							
						
					
					
						commit
						ec53f4c4b2
					
				@ -5,23 +5,23 @@
 | 
				
			|||||||
  tasks:
 | 
					  tasks:
 | 
				
			||||||
  - name: Copy build to remote
 | 
					  - name: Copy build to remote
 | 
				
			||||||
    ansible.builtin.copy:
 | 
					    ansible.builtin.copy:
 | 
				
			||||||
      src: ../build/sour.is-paste
 | 
					      src: ../sour.is-paste
 | 
				
			||||||
      dest: /usr/local/bin/sour.is-paste
 | 
					      dest: /usr/local/bin/sour.is-paste
 | 
				
			||||||
      mode: u=rwx,g=rx,o=rx
 | 
					      mode: u=rwx,g=rx,o=rx
 | 
				
			||||||
      owner: root 
 | 
					      owner: root
 | 
				
			||||||
      group: root
 | 
					      group: root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - name: Copy build to remote
 | 
					  - name: Copy build to remote
 | 
				
			||||||
    ansible.builtin.copy:
 | 
					    ansible.builtin.copy:
 | 
				
			||||||
      src: sour.is-paste.service
 | 
					      src: sour.is-paste.service
 | 
				
			||||||
      dest: /etc/systemd/system/sour.is-paste.service
 | 
					      dest: /etc/systemd/system/sour.is-paste.service
 | 
				
			||||||
      mode: u=r,g=r,o=r 
 | 
					      mode: u=r,g=r,o=r
 | 
				
			||||||
      owner: root 
 | 
					      owner: root
 | 
				
			||||||
      group: root
 | 
					      group: root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - name: Restart service
 | 
					  - name: Restart service
 | 
				
			||||||
    systemd:
 | 
					    systemd:
 | 
				
			||||||
      name: sour.is-paste 
 | 
					      name: sour.is-paste
 | 
				
			||||||
      enabled: true 
 | 
					      enabled: true
 | 
				
			||||||
      daemon_reload: true
 | 
					      daemon_reload: true
 | 
				
			||||||
      state: restarted
 | 
					      state: restarted
 | 
				
			||||||
 | 
				
			|||||||
@ -2,19 +2,15 @@ name: Deploy
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
on:
 | 
					on:
 | 
				
			||||||
  push:
 | 
					  push:
 | 
				
			||||||
    branches: [ "main", "master" ]
 | 
					    branches: [ "main" ]
 | 
				
			||||||
  release:
 | 
					  release:
 | 
				
			||||||
    types: [ published ]
 | 
					    types: [ published ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
jobs:
 | 
					jobs:
 | 
				
			||||||
  deploy:
 | 
					  deploy:
 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:    
 | 
					    steps:
 | 
				
			||||||
    - uses: actions/checkout@v3
 | 
					    - uses: actions/checkout@v3
 | 
				
			||||||
      with:
 | 
					 | 
				
			||||||
        fetch-depth: 0
 | 
					 | 
				
			||||||
        fetch-tags: true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    - run: apt-get update && apt-get -y install ansible
 | 
					    - run: apt-get update && apt-get -y install ansible
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Set up Go
 | 
					    - name: Set up Go
 | 
				
			||||||
@ -22,15 +18,17 @@ jobs:
 | 
				
			|||||||
      with:
 | 
					      with:
 | 
				
			||||||
        go-version: 1.21.1
 | 
					        go-version: 1.21.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Build
 | 
					    - name: Install
 | 
				
			||||||
      run: go build -ldflags "-s -w" -o ./build/sour.is-paste ./cmd/paste
 | 
					      run: go install -ldflags "-s -w" go.sour.is/paste/cmd/paste@latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - run: mv $(go env GOPATH)/bin/paste sour.is-paste
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Compress
 | 
					    - name: Compress
 | 
				
			||||||
      uses: https://git.sour.is/actions/ghaction-upx@v2.4.0
 | 
					      uses: https://git.sour.is/actions/ghaction-upx@v2.4.0
 | 
				
			||||||
      with:
 | 
					      with:
 | 
				
			||||||
        version: latest
 | 
					        version: latest
 | 
				
			||||||
        files: |
 | 
					        files: |
 | 
				
			||||||
            ./build/sour.is-paste
 | 
					            ./sour.is-paste
 | 
				
			||||||
        args: -fq
 | 
					        args: -fq
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    - name: Deploy
 | 
					    - name: Deploy
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user