From 4e9302a1d3c63f946f5b2322eb0501a7dda25579 Mon Sep 17 00:00:00 2001 From: RainbowMango Date: Tue, 1 Jun 2021 10:40:42 +0800 Subject: [PATCH] Add workflows to publish latest image automatically. Signed-off-by: RainbowMango --- .github/workflows/image.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/image.yml diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml new file mode 100644 index 000000000..8491d852f --- /dev/null +++ b/.github/workflows/image.yml @@ -0,0 +1,29 @@ +name: Image +on: + push: + branches: + - master +jobs: + publish-image: + name: publish images + # prevent job running from forked repository, otherwise + # 1. running on the forked repository would fail as missing necessary secret. + # 2. running on the forked repository would use unnecessary GitHub Action time. + if: ${{ github.repository == 'karmada-io/karmada' && github.ref == 'refs/heads/master' }} + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v2 + - name: install Go + uses: actions/setup-go@v2 + with: + go-version: 1.14.x + - name: build images + env: + REGISTRY: ${{secrets.SWR_REGISTRY}} + REGISTRY_USER_NAME: ${{secrets.SWR_REGISTRY_USER_NAME}} + REGISTRY_PASSWORD: ${{secrets.SWR_REGISTRY_PASSWORD}} + REGISTRY_SERVER_ADDRESS: ${{secrets.SWR_REGISTRY_SERVER_ADDRESS}} + VERSION: latest + + run: make upload-images