diff --git a/.github/workflows/ci.github-workflows.yaml b/.github/workflows/ci.github-workflows.yaml deleted file mode 100644 index 9bd8804..0000000 --- a/.github/workflows/ci.github-workflows.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: Github workflows -on: - push: - branches: - - main - paths: - - ".github/workflows/*.yaml" - pull_request: - paths: - - ".github/workflows/*.yaml" - workflow_dispatch: -jobs: - actionlint: - runs-on: ubuntu-latest - steps: - - name: Checkout current git repository - uses: actions/checkout@v3 - - name: Set up go environment - uses: actions/setup-go@v3 - - name: Install actionlint - run: go install github.com/rhysd/actionlint/cmd/actionlint@v1.6.23 - - name: Run actionlint - run: /home/runner/go/bin/actionlint - yamllint: - uses: parcelLab/ci/.github/workflows/yaml.yaml@main - release: - if: github.ref == 'refs/heads/main' - needs: - - actionlint - - yamllint - uses: parcelLab/ci/.github/workflows/release.yaml@main - secrets: - repoAccessToken: ${{ secrets.REPO_ACCESS_TOKEN_OPEN_SOURCE }} diff --git a/.github/workflows/ci.pr.yaml b/.github/workflows/ci.pr.yaml index 1aec4d2..3a4a899 100644 --- a/.github/workflows/ci.pr.yaml +++ b/.github/workflows/ci.pr.yaml @@ -12,3 +12,16 @@ jobs: uses: parcelLab/ci/.github/workflows/pr.yaml@main secrets: repoAccessToken: ${{ secrets.GITHUB_TOKEN }} + actionlint: + runs-on: ubuntu-latest + steps: + - name: Checkout current git repository + uses: actions/checkout@v3 + - name: Set up go environment + uses: actions/setup-go@v3 + - name: Install actionlint + run: go install github.com/rhysd/actionlint/cmd/actionlint@v1.6.23 + - name: Run actionlint + run: /home/runner/go/bin/actionlint + yamllint: + uses: parcelLab/ci/.github/workflows/yaml.yaml@main diff --git a/.github/workflows/ci.release.yaml b/.github/workflows/ci.release.yaml new file mode 100644 index 0000000..bf40b4e --- /dev/null +++ b/.github/workflows/ci.release.yaml @@ -0,0 +1,45 @@ +name: Github workflows +on: + push: + branches: + - main + paths: + - ".github/workflows/*.yaml" + pull_request: + paths: + - ".github/workflows/*.yaml" + workflow_dispatch: +jobs: + update-major-tag: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Extract major version + id: version + run: | + # Get the latest tag created by the release job + TAG_NAME="$(git describe --tags --abbrev=0)" + echo "Retrieved tag: $TAG_NAME" + # Extract major version (e.g., v8.2.7 -> v8) + MAJOR_VERSION="$(echo "$TAG_NAME" | sed -E 's/^v([0-9]+)\..*/v\1/')" + echo "major_version=$MAJOR_VERSION" >> "$GITHUB_OUTPUT" + echo "full_version=$TAG_NAME" >> "$GITHUB_OUTPUT" + - name: Update major version tag + run: | + git config user.name "parcellab-dev-bot" + git config user.email "dev.bot@parcellab.com" + + # Delete existing major version tag if it exists + git tag -d "${{ steps.version.outputs.major_version }}" || true + git push -d origin "${{ steps.version.outputs.major_version }}" || true + + # Create new major version tag pointing to the same commit as the full version + git tag "${{ steps.version.outputs.major_version }}" + git push origin tag "${{ steps.version.outputs.major_version }}" + release: + uses: parcelLab/ci/.github/workflows/release.yaml@main + secrets: + repoAccessToken: ${{ secrets.REPO_ACCESS_TOKEN_OPEN_SOURCE }}