Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #9 from GlueOps/chore/cleanup-action
Browse files Browse the repository at this point in the history
Chore/cleanup action
  • Loading branch information
fernandoataoldotcom authored Oct 10, 2023
2 parents 69ade0c + e5a459b commit e790c1c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 79 deletions.
67 changes: 1 addition & 66 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,70 +9,5 @@ Automate your Docker image deployments effortlessly with this custom GitHub Acti
✅ Seamless integration: GitHub Container Registry simplifies container image management.

## 🛠️ How to Use
- In your repository's settings, under the ```Actions``` tab
- Click on ```General```, scroll to the bottom and enable ```Read and write permissions``` for your ```Workflow Permissions```.
- Click ```Save```.

<img width="1143" alt="image" src="https://github.com/Mbaoma/build-image/assets/49791498/92ff77e4-16a9-4798-85bd-3d0ee9a5cb11">

*Actions Tab*

<img width="1143" alt="image" src="https://github.com/Mbaoma/build-image/assets/49791498/6e8d3834-e10f-4cc1-b320-bfe58e1cfed5">

*Permission Update*

- Add this step to your workflow as follows:
```Docker
name: GlueOps Action
on: [push]
jobs:
build_tag_push_to_ghcr:
runs-on: ubuntu-latest
steps:
- name: Build, Tag and Push Docker Image to GHCR
uses: GlueOps/github-actions-build-push-containers@v0.1.3
```

## 🔖 Image Tags
Your image is automatically tagged based on the event behind the image creation.

### Image Tagging Scenario: On Push Event 🚀
Whenever a push event occurs in the repository, this workflow automatically assigns relevant tags to your image. The tags include the ```branch slug```, ```short SHA (commit identifier)```, and ```long SHA```, providing valuable context about the image's origin and version.

For example, let's consider a scenario where you have a GitHub repository for a web application called ```MyWebApp```. Whenever a developer pushes changes to the ```develop``` branch, the workflow automatically tags the image with the following details:

| Key | Value |
| --- | --- |
| Branch slug | develop |
| Short SHA | 32b5b6b |
| Long SHA | 32b5b6b7bd6e070f8f176e1423938d66072e6463 |


### Image Tagging Scenario: On Release Event 🚀
Whenever a release event occurs in the repository, the action automatically assigns relevant tags to your image. The tags include the ```release version```, ```short SHA (commit identifier)```, and ```long SHA```, providing valuable context about the image's origin and version.

For example, let's consider a scenario where you have a GitHub repository for a web application called ```MyWebApp```. Whenever a developer creates a new release with version ```v1.0.0```, the action automatically tags the image with the following details:

| Key | Value |
| --- | --- |
| Release version | v1.0.0 |
| Short SHA | 32b5b6b |
| Long SHA | 32b5b6b7bd6e070f8f176e1423938d66072e6463 |

These automated tagging processes ensures that you can easily track and identify specific versions of your application, streamlining your development and deployment workflows.

## 🏳️ Defaults
- Your ```Dockerfile``` has to be in the root directory.
- Your ```docker image``` is named after your repository.

## Pushing to GitHub
```bash
$ git add .
$ git commit -m 'commit-message'
$ git tag -a -m "Description of this release" v0.0.0 (replace with your version tag)
$ git push --follow-tags
```

This workflow is inspired by [macbre's](https://github.com/macbre/push-to-ghcr) work.
For usage instructions, refer to the [GlueOps Documentation](https://glueops.dev/docs/deploy-applications/deploy-hello-world-to-glueops#add-ci-to-publish-a-docker-image-to-github-container-registry).
13 changes: 0 additions & 13 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,6 @@ runs:
echo "::group::Set commit tags"
echo "Event payload: ${{ toJson(github.event_name) }}"
#for release events, the tag name is available as github.event.release.tag_name, long SHA as github.sha and short SHA as github.sha_short
# if [ "${{ github.event_name }}" = "release" ]; then
# export TAG_NAME="${{ github.event.release.tag_name }}"
# export COMMIT_TAG="${TAG_NAME#refs/tags/}"
# export SHA="${{ github.sha }}"
# export SHORT_SHA="${SHA:0:7}"
# echo "Release Version ${COMMIT_TAG}"
# echo "Short SHA ${SHORT_SHA}"
# echo "Long SHA ${SHA}"
# else
#for commits, the tag name is available as github.ref, long SHA as github.sha and short SHA as github.sha_short
if [ -z "${IMAGE_TAG}" ]; then
BRANCH_NAME="${BRANCH_NAME#refs/tags/}"
Expand All @@ -104,7 +92,6 @@ runs:
echo "Short SHA ${SHORT_SHA}"
echo "Long SHA ${SHA}"
fi
# fi
# convert the image name to lowercase
export IMAGE_NAME=$(echo "${IMAGE_NAME}" | tr '[:upper:]' '[:lower:]')
Expand Down

0 comments on commit e790c1c

Please sign in to comment.