drone test

This commit is contained in:
Evann Regnault 2024-04-01 12:42:14 +02:00
parent 1fe95bdc18
commit c1095398a6
2 changed files with 20 additions and 59 deletions

20
.drone.yml Normal file
View file

@ -0,0 +1,20 @@
kind: pipeline
name: build
type: docker
steps:
- name: get cargo tag
image: rust:alpine
commands:
- cargo install cargo-get
- echo "$(cargo get package.version --pretty),latest" > .tags
- name: build
image: plugins/docker
settings:
registry: r.regnault.dev
username:
from_secret: DOCKER_USERNAME
password:
from_secret: DOCKER_PASSWORD
repo: r.regnault.dev/obsessed-yanqing

View file

@ -1,59 +0,0 @@
name: Docker Build and Push with Version
on:
push:
branches:
- master
- action-test
env:
DOCKER_REGISTRY: r.regnault.dev
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
PORTAINER_API_WEBHOOK: ${{ secrets.PORTAINER_API_WEBHOOK }}
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Install cargo-semver
uses: actions-rs/install@v0.1.2
with:
crate: cargo-get
version: latest
- name: Semver
run:
echo "VERSION=$(cargo get package.version --pretty)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
${{ env.DOCKER_REGISTRY }}/obsessed-yanqing:latest
${{ env.DOCKER_REGISTRY }}/obsessed-yanqing:${{ env.VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy to production
uses: fjogeleit/http-request-action@v1.14.1
with:
url: ${{ format('{0}?tag={1}',env.PORTAINER_API_WEBHOOK, env.VERSION) }}
method: 'POST'
preventFailureOnNoResponse: true