diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 6539daf49fb7a..0000000000000 --- a/.drone.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -kind: pipeline -name: default - -platform: - os: linux - arch: amd64 - -steps: -- name: fetch - image: alpine/git - commands: - - git fetch origin refs/tags/${DRONE_TAG}:refs/tags/${DRONE_TAG} --no-tags - when: - event: - - tag - -- name: ci - pull: default - image: rancher/dapper:1.11.2 - commands: - - dapper ci - - ls -lR output/bin - privileged: true - volumes: - - name: socket - path: /var/run/docker.sock - when: - event: - - pull_request - - tag - -- name: github_binary_release - pull: default - image: plugins/github-release - settings: - checksum: - - sha256 - files: - - "output/bin/kubelet*" - api_key: - from_secret: github_token - title: "${DRONE_TAG}" - when: - instance: - include: - - drone-publish.rancher.io - event: - - tag - ref: - exclude: - - "refs/tags/*rc*" - - "refs/tags/*alpha*" - -volumes: -- name: socket - host: - path: /var/run/docker.sock - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000000..d2e6934e9c47b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: Dapper CI on PR +run-name: CI on ${{ github.event_name }} + +on: + pull_request: + push: + branches: + - '*' + +jobs: + validate: + runs-on: ubuntu-latest + container: + image: rancher/dapper:v0.6.0 + permissions: + contents: read + steps: + - name: Fix the not-a-git-repository issue + run: | + apk -U add git + git config --global --add safe.directory "$GITHUB_WORKSPACE" + + - name: Checkout code + uses: actions/checkout@v4 + + - name: build with Dapper + run: dapper ci + + - name: LS the bin + run: ls -lR output/bin \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000000..f43d73d018de3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,64 @@ +name: Release When Tagged +run-name: Release ${{ github.ref_name }} + +on: + push: + tags: '*' + +jobs: + validate: + runs-on: ubuntu-latest + container: + image: rancher/dapper:v0.6.0 + permissions: + contents: read + steps: + - name: Check For Alpha / RC in Release + if: contains(github.ref_name, 'rc') || contains(github.ref_name, 'alpha') + uses: actions/github-script@v7 + with: + script: | + core.setFailed('No RCs or Alphas are released in this repo. Skipping release...') + + - name: Fix the not-a-git-repository issue + run: | + apk -U add git + git config --global --add safe.directory "$GITHUB_WORKSPACE" + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: build with Dapper + run: dapper ci + + - name: Archive production artifacts + uses: actions/upload-artifact@v4 + with: + name: kubernetes-build + path: output/bin + if-no-files-found: error + overwrite: true + + create-release: + runs-on: ubuntu-latest + needs: + - validate + permissions: + contents: write # needed for creating the GH release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download assets + uses: actions/download-artifact@v4 + + - name: Create GH Release + run: | + gh release create ${{ github.ref_name }} --verify-tag --generate-notes kubernetes-build/* diff --git a/scripts/build b/scripts/build index d062c44401ed1..45187aed4214f 100755 --- a/scripts/build +++ b/scripts/build @@ -10,8 +10,8 @@ KUBE_BUILD_PLATFORMS="linux/arm64 linux/amd64" K8S_BASE="k8s.io/component-base" mkdir -p output/bin -if [ -n "$DRONE_TAG" ]; then - TAG=$DRONE_TAG +if [ -n "$VERSION" ]; then + TAG=$VERSION fi buildDate=$(date -u '+%Y-%m-%dT%H:%M:%SZ') @@ -32,6 +32,8 @@ for ARCH in ${OS_ARCH_LINUX}; do tar -cvzf output/bin/kubelet-$TAG-$ARCH.tar.gz kubelet && rm kubelet done +sha256sum output/bin/* > output/bin/sha256sum.txt + rm -rf _output/ echo Built ${TAG}