Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update repo name #52

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 41 additions & 12 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
env:
DOCKERFILE_PATH: '.'
DOCKERFILE_FILENAME: 'Dockerfile'
DOCKER_IMAGE_NAME: 'lequal/sonarqube'
DOCKER_IMAGE_NAME: 'lequal/sonarqube-catlab'

jobs:
# Job to test if a new version is ready to be released
Expand All @@ -48,7 +48,7 @@ jobs:
if [ "$milestones" == "[]" ]
then
echo No milestone completed, not delivering
echo "::set-output name=delivery::forbidden"
echo "delivery=forbidden" >> $GITHUB_OUTPUT
exit 0
fi
echo -e "Completed milestones:\n$milestones"
Expand All @@ -62,17 +62,17 @@ jobs:
exit 1
fi
echo Ready to deliver
echo "::set-output name=version::$version"
echo "::set-output name=milestone_number::$milestone_number"
echo "::set-output name=delivery::allowed"
echo "version=$version" >> $GITHUB_OUTPUT
echo "milestone_number=$milestone_number" >> $GITHUB_OUTPUT
echo "delivery=allowed" >> $GITHUB_OUTPUT
release:
name: Release a new version of the docker image
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: deliverability
if: needs.deliverability.outputs.delivery == 'allowed'
steps:
# git clone
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Merge develop into master (fast forward) and tag master
Expand All @@ -91,7 +91,7 @@ jobs:
run: |
tags=($(git tag --sort="-v:refname" | grep -P -e '[0-9]+\.[0-9]+\.[0-9]+'))
echo The tag of the previous release is ${tags[1]}
echo "::set-output name=tag::${tags[1]}"
echo "tag=${tags[1]}" >> $GITHUB_OUTPUT
# Generate the changelog since last release
- name: Generate the changelog
uses: charmixer/auto-changelog-action@v1
Expand Down Expand Up @@ -124,34 +124,63 @@ jobs:
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_IMAGE_NAME }}

#Push with current name and version number tag
- name: Build and push Docker image to version number
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
uses: docker/build-push-action@v5
with:
context: .
file: ${{ env.DOCKERFILE_PATH }}/${{ env.DOCKERFILE_FILENAME }}
push: true
tags: ${{ env.DOCKER_IMAGE_NAME}}:${{ needs.deliverability.outputs.version }}
labels: ${{ steps.meta.outputs.labels }}

#Push with current name and latest tag
- name: Build and push Docker image to lastest repo
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
uses: docker/build-push-action@v5
with:
context: .
file: ${{ env.DOCKERFILE_PATH }}/${{ env.DOCKERFILE_FILENAME }}
push: true
tags: ${{ env.DOCKER_IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}

#Push with old name and version number tag
- name: Build and push Docker image to version number
uses: docker/build-push-action@v5
with:
context: .
file: ${{ env.DOCKERFILE_PATH }}/${{ env.DOCKERFILE_FILENAME }}
push: true
tags: lequal/sonarqube:${{ needs.deliverability.outputs.version }}
labels: ${{ steps.meta.outputs.labels }}

#Push with old name and latest tag
- name: Build and push Docker image to lastest repo
uses: docker/build-push-action@v5
with:
context: .
file: ${{ env.DOCKERFILE_PATH }}/${{ env.DOCKERFILE_FILENAME }}
push: true
tags: lequal/sonarqube:latest
labels: ${{ steps.meta.outputs.labels }}

- name: Update repo description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
repository: cnescatlab/docker-cat

close_milestone:
name: Close milestone
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:
env:
DOCKERFILE_PATH: '.'
DOCKERFILE_FILENAME: 'Dockerfile'
DOCKER_IMAGE_NAME: 'lequal/sonarqube'
DOCKER_IMAGE_NAME: 'lequal/sonarqube-catlab'

jobs:
# Job that builds the image and upload it as an artifact
Expand All @@ -34,13 +34,13 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build docker image
run: docker build -t $DOCKER_IMAGE_NAME $DOCKERFILE_PATH
- name: Save Docker image
run: docker image save -o image.tar $DOCKER_IMAGE_NAME
- name: Upload image as an artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: image
path: image.tar
Expand All @@ -50,9 +50,9 @@ jobs:
runs-on: ubuntu-22.04
needs: build
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Retrieve the image
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: image
- name: Load the image
Expand Down