diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index e041a4a0..00000000 --- a/.drone.yml +++ /dev/null @@ -1,109 +0,0 @@ ---- -kind: pipeline -name: amd64 - -platform: - os: linux - arch: amd64 - -steps: - - name: validate - image: rancher/dapper:v0.5.4 - commands: - - dapper validate - volumes: - - name: docker - path: /var/run/docker.sock - when: - branch: - - master - event: - - push - - pull_request - - tag - - - name: test - image: rancher/dapper:v0.5.4 - commands: - - dapper test - volumes: - - name: docker - path: /var/run/docker.sock - when: - branch: - - master - event: - - pull_request - - - name: add-commit-to-version-file - image: rancher/dapper:v0.5.4 - commands: - - 'echo {\"version\": \"${DRONE_COMMIT}\"} > dist/VERSION' - volumes: - - name: docker - path: /var/run/docker.sock - when: - branch: - - master - event: - - push - - - name: upload-dev - pull: default - image: plugins/gcs - settings: - acl: - - allUsers:READER - cache_control: "public,no-cache,proxy-revalidate" - source: dist/ - ignore: ".gitkeep" - target: releases.rancher.com/install-docker-dev - token: - from_secret: google_auth_key - when: - instance: - include: - - drone-publish.rancher.io - branch: - - master - event: - - push - - - name: add-tag-to-version-file - image: rancher/dapper:v0.5.4 - commands: - - 'echo {\"version\": \"${DRONE_TAG}\"} > dist/VERSION' - volumes: - - name: docker - path: /var/run/docker.sock - when: - branch: - - master - event: - - tag - - - name: upload - pull: default - image: plugins/gcs - settings: - acl: - - allUsers:READER - cache_control: "public,no-cache,proxy-revalidate" - source: dist/ - ignore: ".gitkeep" - target: releases.rancher.com/install-docker - token: - from_secret: google_auth_key - when: - instance: - include: - - drone-publish.rancher.io - branch: - - master - event: - - tag - -volumes: -- name: docker - host: - path: /var/run/docker.sock diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml new file mode 100644 index 00000000..8e4f7639 --- /dev/null +++ b/.github/workflows/workflow.yaml @@ -0,0 +1,100 @@ +name: Workflow for install-docker + +on: + push: + branches: + - master + tags: + - '*' + pull_request: + branches: + - master + +jobs: + validate: + permissions: + contents: read + runs-on: ubuntu-latest + container: + image: rancher/dapper:v0.6.0 + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Validate + run: dapper validate + + test: + permissions: + contents: read + needs: validate + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + container: + image: rancher/dapper:v0.6.0 + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Test + run: dapper test + + upload-dev: + permissions: + contents: read + id-token: write + needs: [validate, test] + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Add commit to version file + run: | + echo "{\"version\": \"${{ github.sha }}\"}" > dist/VERSION" + - name: Retrieve Google auth from vault + uses: rancher-eio/read-vault-secrets@main + with: + secrets: | + secret/data/github/repo/${{ github.repository }}/google-auth/rancher/credentials | GOOGLE_AUTH + - name: Authenticate with Google Cloud + uses: 'google-github-actions/auth@v2' + with: + credentials_json: '${{ env.GOOGLE_AUTH }}' + - name: Upload to Google Cloud Storage + uses: google-github-actions/upload-cloud-storage@v2 + with: + path: dist/ + destination: releases.rancher.com/install-docker-dev + predefinedAcl: publicRead + headers: |- + Cache-Control: public,no-cache,proxy-revalidate + + upload: + permissions: + contents: read + id-token: write + needs: [validate, test] + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref_type == 'tag' + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Add tag to version file + run: | + echo "{\"version\": \"${{ github.ref_name }}\"}" > dist/VERSION" + - name: Retrieve Google auth from vault + uses: rancher-eio/read-vault-secrets@main + with: + secrets: | + secret/data/github/repo/${{ github.repository }}/google-auth/rancher/credentials | GOOGLE_AUTH + - name: Authenticate with Google Cloud + uses: 'google-github-actions/auth@v2' + with: + credentials_json: '${{ env.GOOGLE_AUTH }}' + - name: Upload to Google Cloud Storage + uses: google-github-actions/upload-cloud-storage@v2 + with: + path: dist/ + destination: releases.rancher.com/install-docker + predefinedAcl: publicRead + headers: |- + Cache-Control: public,no-cache,proxy-revalidate \ No newline at end of file diff --git a/.gitignore b/.gitignore index 01227f33..e1bc6988 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /bin *.swp .idea +# Ignore generated credentials from google-github-actions/auth +gha-creds-*.json \ No newline at end of file