aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/ci.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/ci.yml')
-rw-r--r--.github/workflows/ci.yml42
1 files changed, 25 insertions, 17 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 947238a..4b07403 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -22,24 +22,32 @@ jobs:
- name: Run tests
run: make test
- deploy:
+ publish_docker:
needs: [test]
runs-on: ubuntu-latest
- name: Deploy
- if: github.ref == 'refs/heads/master'
- env:
- DOCKER_HOST: 'tcp://${{ secrets.DEPLOY_DOCKER_HOST }}:${{ secrets.DEPLOY_DOCKER_PORT }}'
+ name: 'Publish: Docker Hub'
+ if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
steps:
- - name: Checkout
- uses: actions/checkout@v2
- - name: Set up VPN
- uses: egor-tensin/setup-wireguard@v1
+ - id: meta
+ name: Docker Hub metadata
+ uses: docker/metadata-action@v3
+ with:
+ images: '${{ secrets.DOCKERHUB_USERNAME }}/void'
+ flavor: |
+ latest=auto
+ tags: |
+ type=ref,event=branch
+ type=semver,pattern={{version}}
+ type=semver,pattern={{major}}.{{minor}}
+ type=semver,pattern={{major}}
+ - name: Login to Docker Hub
+ uses: docker/login-action@v1
+ with:
+ username: '${{ secrets.DOCKERHUB_USERNAME }}'
+ password: '${{ secrets.DOCKERHUB_TOKEN }}'
+ - name: Build and publish
+ uses: docker/build-push-action@v2
with:
- endpoint: '${{ secrets.WG_ENDPOINT }}'
- endpoint_public_key: '${{ secrets.WG_ENDPOINT_PUBLIC_KEY }}'
- ips: '${{ secrets.WG_IPS }}'
- allowed_ips: '${{ secrets.WG_ALLOWED_IPS }}'
- private_key: '${{ secrets.WG_PRIVATE_KEY }}'
- preshared_key: '${{ secrets.WG_PRESHARED_KEY }}'
- - name: Deploy
- run: make deploy
+ push: true
+ tags: '${{ steps.meta.outputs.tags }}'
+ labels: '${{ steps.meta.outputs.labels }}'