|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - v* |
| 6 | + branches: |
| 7 | + - master |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - master |
| 11 | +env: |
| 12 | + REGISTRY: registry-write.deckhouse.io |
| 13 | + IMAGE_NAME: yandex-csi-driver/yandex-csi-driver |
| 14 | +jobs: |
| 15 | + lint: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + # https://github.com/golangci/golangci-lint-action |
| 20 | + - name: golangci-lint |
| 21 | + uses: golangci/golangci-lint-action@v2 |
| 22 | + with: |
| 23 | + version: v1.42 |
| 24 | + args: --timeout=5m |
| 25 | + build: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + permissions: |
| 28 | + contents: read |
| 29 | + packages: write |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v2 |
| 32 | + # Login against a Docker registry except on PR |
| 33 | + # https://github.com/docker/login-action |
| 34 | + - name: Log into registry ${{ env.REGISTRY }} |
| 35 | + if: github.event_name != 'pull_request' |
| 36 | + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c |
| 37 | + with: |
| 38 | + registry: ${{ env.REGISTRY }} |
| 39 | + username: ${{ secrets.DECKHOUSE_REGISTRY_USER }} |
| 40 | + password: ${{ secrets.DECKHOUSE_REGISTRY_PASSWORD }} |
| 41 | + # Extract metadata (tags, labels) for Docker |
| 42 | + # https://github.com/docker/metadata-action |
| 43 | + - name: Extract Docker metadata |
| 44 | + id: meta |
| 45 | + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 |
| 46 | + with: |
| 47 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 48 | + # Build and push Docker image with Buildx (don't push on PR) |
| 49 | + # https://github.com/docker/build-push-action |
| 50 | + - name: Build and push Docker image |
| 51 | + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc |
| 52 | + with: |
| 53 | + context: . |
| 54 | + push: ${{ github.event_name != 'pull_request' }} |
| 55 | + tags: ${{ steps.meta.outputs.tags }} |
| 56 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments