diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index f06b9477..00000000 --- a/.drone.yml +++ /dev/null @@ -1,239 +0,0 @@ ---- -kind: pipeline -name: default-amd64 - -platform: - os: linux - arch: amd64 - -trigger: - branch: - - master - - main - - v* - -steps: -- name: fossa - image: registry.suse.com/bci/bci-base:15.5 - failure: ignore - environment: - FOSSA_API_KEY: - from_secret: FOSSA_API_KEY - commands: - - zypper -n install curl unzip - - "curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/spectrometer/master/install.sh | sh" - - fossa analyze - - fossa test - when: - instance: - - drone-publish.longhorn.io - ref: - include: - - "refs/heads/master" - event: - - push - - tag - -- name: publish-image - image: plugins/docker - settings: - build_args: - - "VERSION=${DRONE_COMMIT:0:7}" - - ARCH=amd64 - custom_dns: 1.1.1.1 - dockerfile: Dockerfile - password: - from_secret: docker_password - repo: longhornio/longhorn-ui - tag: "${DRONE_BRANCH}-head-amd64" - username: - from_secret: docker_username - when: - event: - - push - -- name: publish-tagged-image - image: plugins/docker - settings: - build_args: - - "VERSION=${DRONE_TAG}" - - ARCH=amd64 - custom_dns: 1.1.1.1 - dockerfile: Dockerfile - password: - from_secret: docker_password - repo: longhornio/longhorn-ui - tag: "${DRONE_TAG}-amd64" - username: - from_secret: docker_username - when: - event: - - tag - -- name: slack_notify - image: plugins/slack - settings: - template: "Build {{build.link}} failed.\n" - username: Drone_Publish - webhook: - from_secret: slack_webhook - when: - event: - exclude: - - pull_request - instance: - include: - - drone-publish.longhorn.io - status: - - failure - -volumes: -- name: socket - host: - path: /var/run/docker.sock ---- -kind: pipeline -name: default-arm64 - -platform: - os: linux - arch: arm64 - -trigger: - branch: - - master - - main - - v* - -steps: -- name: publish-image - image: plugins/docker - settings: - build_args: - - "VERSION=${DRONE_COMMIT:0:7}" - - ARCH=arm64 - custom_dns: 1.1.1.1 - dockerfile: Dockerfile - password: - from_secret: docker_password - repo: longhornio/longhorn-ui - tag: "${DRONE_BRANCH}-head-arm64" - username: - from_secret: docker_username - when: - event: - - push - -- name: publish-tagged-image - image: plugins/docker - settings: - build_args: - - "VERSION=${DRONE_TAG}" - - ARCH=arm64 - custom_dns: 1.1.1.1 - dockerfile: Dockerfile - password: - from_secret: docker_password - repo: longhornio/longhorn-ui - tag: "${DRONE_TAG}-arm64" - username: - from_secret: docker_username - when: - event: - - tag - -- name: slack_notify - image: plugins/slack - settings: - template: "Build {{build.link}} failed.\n" - username: Drone_Publish - webhook: - from_secret: slack_webhook - when: - event: - exclude: - - pull_request - instance: - include: - - drone-publish.longhorn.io - status: - - failure - -volumes: -- name: socket - host: - path: /var/run/docker.sock ---- -kind: pipeline -name: manifest - -platform: - os: linux - arch: amd64 - -trigger: - event: - exclude: - - pull_request - branch: - - master - - main - - v* - -steps: -- name: manifest - image: plugins/manifest:1 - settings: - username: - from_secret: docker_username - password: - from_secret: docker_password - platforms: - - linux/amd64 - - linux/arm64 - target: "longhornio/longhorn-ui:${DRONE_BRANCH}-head" - template: "longhornio/longhorn-ui:${DRONE_BRANCH}-head-ARCH" - when: - instance: - - drone-publish.longhorn.io - event: - - push - -- name: manifest-tag - image: plugins/manifest:1 - settings: - username: - from_secret: docker_username - password: - from_secret: docker_password - platforms: - - linux/amd64 - - linux/arm64 - target: "longhornio/longhorn-ui:${DRONE_TAG}" - template: "longhornio/longhorn-ui:${DRONE_TAG}-ARCH" - when: - instance: - - drone-publish.longhorn.io - event: - - tag - -- name: slack_notify - image: plugins/slack - settings: - template: "Build {{build.link}} failed.\n" - username: Drone_Publish - webhook: - from_secret: slack_webhook - when: - event: - exclude: - - pull_request - instance: - include: - - drone-publish.longhorn.io - status: - - failure - -depends_on: -- default-amd64 -- default-arm64 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..aac303fb --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,57 @@ +name: build +on: + push: + branches: + - master + - v* + tags: + - v* + pull_request: +jobs: + build_push_image: + name: Build and push image + runs-on: ubuntu-latest + if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + # For multi-platform support + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Declare branch + run: | + echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" + echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_ENV" + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + # longhornio/longhorn-ui image + - name: docker-publish + if: ${{ startsWith(github.ref, 'refs/heads/') }} + uses: docker/build-push-action@v5 + with: + push: true + platforms: linux/amd64,linux/arm64 + tags: longhornio/longhorn-ui:${{ env.branch }}-head + file: Dockerfile + build-args: | + VERSION=${{ env.sha_short }} + + - name: docker-publish-with-tag + if: ${{ startsWith(github.ref, 'refs/tags/') }} + uses: docker/build-push-action@v5 + with: + push: true + platforms: linux/amd64,linux/arm64 + tags: longhornio/longhorn-ui:${{ github.ref_name }} + file: Dockerfile + build-args: | + VERSION=${{ github.ref_name }}