[version] bump to v1.2.7 #59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push | |
| on: | |
| push: | |
| branches: | |
| - main | |
| env : | |
| REPOSITORY: 'quay-its.epfl.ch' | |
| REGISTRY_PATH: 'quay-its.epfl.ch/svc0176/eeee' | |
| jobs: | |
| get_version: | |
| runs-on: ubuntu-latest | |
| name: Get Version | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| should_build: ${{ steps.build_needed.outputs.should_build }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Check version | |
| id: version | |
| run: echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT | |
| - name: Check if builds needed | |
| id: build_needed | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| TAG_NAME="v$VERSION" | |
| set +e | |
| gh release view "$TAG_NAME" >/dev/null 2>&1 | |
| RELEASE_EXISTS=$? | |
| set -e | |
| if [ $RELEASE_EXISTS -eq 0 ]; then | |
| echo "should_build=false" >> $GITHUB_OUTPUT | |
| echo "✅ Release $TAG_NAME already exists - skipping build" | |
| else | |
| echo "should_build=true" >> $GITHUB_OUTPUT | |
| echo "🆕 Release $TAG_NAME doesn't exist - build needed" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| docker_image: | |
| runs-on: ubuntu-latest | |
| name: Build and Push Image | |
| needs: [get_version] | |
| if: needs.get_version.outputs.should_build == 'true' | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Login to Quay | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REPOSITORY }} | |
| username: ${{ secrets.QUAY_ROBOT_USERNAME }} | |
| password: ${{ secrets.QUAY_ROBOT_PASSWORD }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ env.REGISTRY_PATH }}:${{ needs.get_version.outputs.version }} | |
| build_release: | |
| runs-on: ubuntu-latest | |
| name: Build Release | |
| needs: [get_version, docker_image] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Generate Release Notes | |
| id: generate_notes | |
| run: | | |
| VERSION="${{ needs.get_version.outputs.version }}" | |
| LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
| touch release_notes.txt | |
| if [ -z "$LAST_TAG" ]; then | |
| COMMITS_COUNT=$(git rev-list HEAD --count) | |
| AUTHORS=$(git log --pretty=format:"%an" | sort -u | sed 's/.*$/`&`/' | paste -sd ',' | sed 's/,/, /g') | |
| COMMITS=$(git log --oneline -10 --pretty=format:"%h %s") | |
| echo "Initial release v$VERSION with $COMMITS_COUNT commits by $AUTHORS." >> release_notes.txt | |
| else | |
| COMMITS_COUNT=$(git rev-list ${LAST_TAG}..HEAD --count) | |
| AUTHORS=$(git log ${LAST_TAG}..HEAD --pretty=format:"%an" | sort -u | sed 's/.*$/`&`/' | paste -sd ',' | sed 's/,/, /g') | |
| COMMITS=$(git log --oneline ${LAST_TAG}..HEAD --pretty=format:"%h %s") | |
| echo "Release v$VERSION includes $COMMITS_COUNT commits since $LAST_TAG by $AUTHORS." >> release_notes.txt | |
| fi | |
| FEATURE_COMMITS=$(echo "$COMMITS" | grep -iE "\[(add|feat|feature)\]" | sed 's/^/- /' || echo "") | |
| if [ -n "$FEATURE_COMMITS" ]; then | |
| echo "" >> release_notes.txt | |
| echo "### ✨ Features" >> release_notes.txt | |
| echo "$FEATURE_COMMITS" >> release_notes.txt | |
| fi | |
| FIX_COMMITS=$(echo "$COMMITS" | grep -iE "\[(fix|bugfix|hotfix)\]" | sed 's/^/- /' || echo "") | |
| if [ -n "$FIX_COMMITS" ]; then | |
| echo "" >> release_notes.txt | |
| echo "### 🐛 Bug Fixes" >> release_notes.txt | |
| echo "$FIX_COMMITS" >> release_notes.txt | |
| fi | |
| MAINTENANCE_COMMITS=$(echo "$COMMITS" | grep -iE "\[(version|refactor|chore|style|perf|update|improve)\]" | sed 's/^/- /' || echo "") | |
| if [ -n "$MAINTENANCE_COMMITS" ]; then | |
| echo "" >> release_notes.txt | |
| echo "### 🔧 Maintenance" >> release_notes.txt | |
| echo "$MAINTENANCE_COMMITS" >> release_notes.txt | |
| fi | |
| DOC_COMMITS=$(echo "$COMMITS" | grep -iE "\[(docs|doc|documentation)\]" | sed 's/^/- /' || echo "") | |
| if [ -n "$DOC_COMMITS" ]; then | |
| echo "" >> release_notes.txt | |
| echo "### 📚 Documentation" >> release_notes.txt | |
| echo "$DOC_COMMITS" >> release_notes.txt | |
| fi | |
| OTHER_COMMITS=$(echo "$COMMITS" | grep -viE "\[(add|feat|feature|fix|bugfix|hotfix|version|refactor|chore|style|perf|update|improve|docs|doc|documentation)\]" | sed 's/^/- /' || echo "") | |
| if [ -n "$OTHER_COMMITS" ]; then | |
| echo "" >> release_notes.txt | |
| echo "### 🔄 Other Changes" >> release_notes.txt | |
| echo "$OTHER_COMMITS" >> release_notes.txt | |
| fi | |
| - name: Create release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG_NAME: v${{ needs.get_version.outputs.version }} | |
| run: | | |
| gh release create "$TAG_NAME" \ | |
| --title "$TAG_NAME" \ | |
| --notes-file release_notes.txt \ | |
| --latest |