Skip to content

Cum să rulezi build-uri la crearea tag-urilor în Drone CI

DodaTech Updated 2025-01-15 1 min read

In this tutorial, you'll learn about Cum să rulezi build. We cover key concepts, practical examples, and best practices.

Build-urile declanșate de tag-uri sunt ideale pentru release-uri și deploy-uri automate în producție.

Configurare de bază

kind: pipeline
name: release

steps:
  - name: build
    image: golang:1.20
    commands:
      - go build -o app-${DRONE_TAG}

trigger:
  event:
    - tag

Filtrare după tag

trigger:
  event:
    - tag
  ref:
    - refs/tags/v*
    - refs/tags/release-*

Release automat

steps:
  - name: build
    image: golang:1.20
    commands:
      - go build -o app
      - tar -czf app-${DRONE_TAG}.tar.gz app

  - name: github-release
    image: plugins/github-release
    settings:
      api_key:
        from_secret: github_token
      files: app-${DRONE_TAG}.tar.gz
      title: Release ${DRONE_TAG}

Deploy la tag semantic

trigger:
  event:
    - tag
  ref:
    include:
      - refs/tags/v[0-9]*.[0-9]*.[0-9]*

Prevenire

  • Folosește versionare semantică pentru tag-uri
  • Testează pipeline-ul înainte de a crea tag-ul
  • Verifică filtrele de tag în configurație

DodaTech Tools

Doda Browser notifică despre release-uri noi. DodaZIP arhivează artefactele fiecărui release.

Întrebări frecvente

### Pot filtra tag-urile după un pattern specific?

Da, folosește ref cu pattern-uri glob pentru a filtra tag-urile după nume.

DRONE_TAG este disponibil automat?

Da, variabila DRONE_TAG este populată automat la evenimentele de tip tag.

Pot combina tag cu alte evenimente?

Da, poți defini trigger-uri multiple pentru același pipeline.

Construit de echipa Doda Browser, DodaZIP și Durga Antivirus Pro.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro