diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91662dc04..39921ed28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: CI on: push: tags: - - v* + - "*" branches: - "main" - "releases/v3.x" @@ -13,6 +13,12 @@ on: - "main" - "releases/v3.x" - "chore/fix-ci" + workflow_dispatch: + inputs: + tag: + description: 'Tag to run the workflow for' + required: false + default: '' jobs: docker: @@ -25,6 +31,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + ref: ${{ github.event.inputs.tag || github.ref }} - name: Install dependencies run: sudo apt-get update && sudo apt-get install -y jq curl git @@ -46,9 +53,15 @@ jobs: curl --silent -L --output ~/.docker/cli-plugins/docker-buildx $BUILDX_URL chmod a+x ~/.docker/cli-plugins/docker-buildx - - name: Get version from git tags + - name: Get version from git tags or input id: get_version - run: echo "VERSION=v$(git describe --tags --abbrev=0 | sed 's/^v//')" >> $GITHUB_ENV + run: | + if [ -n "${{ github.event.inputs.tag }}" ]; then + VERSION=${{ github.event.inputs.tag }} + else + VERSION=$(git describe --tags --abbrev=0) + fi + echo "VERSION=$VERSION" >> $GITHUB_ENV - name: Log in to Docker Hub run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin @@ -62,16 +75,6 @@ jobs: endpoint: "neutronorg/neutron" install: true -# - name: Build and push -# uses: docker/build-push-action@v5 -# with: -# context: . -# file: Dockerfile.builder -# tags: "${{ env.VERSION }}" -# # For pull requests, export results to the build cache. -# # Otherwise, push to a registry. -# outputs: ${{ github.event_name == 'pull_request' && 'type=cacheonly' || 'type=registry,push=true' }} - - name: Build and push Docker image env: VERSION: ${{ env.VERSION }} @@ -84,4 +87,3 @@ jobs: - name: Cleanup temporary container run: docker rm -f neutronbinary || true -