Skip to content

Commit

Permalink
Use pose to define tag
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsarm committed Apr 25, 2024
1 parent d5ea44d commit fe62f81
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,60 +11,66 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Download pose
run: wget https://github.com/mrsarm/pose/releases/download/0.4.0-b5/pose-0.4.0-b5-x86_64-unknown-linux-gnu.tar.gz
- name: Unpack pose
run: tar -xvf pose*.tar.gz

- name: Define $TAG variable
run: ./pose slug $GITHUB_REF_NAME" >> $TAG

- name: Build the Docker image
run: ./docker-build.sh "${GITHUB_REF_SLUG}"
run: ./docker-build.sh $TAG

- name: Run tests
run: docker run --rm -e PROCESS_TYPE=test --name django-coleman "mrsarm/django-coleman:${GITHUB_REF_SLUG}"
run: docker run --rm -e PROCESS_TYPE=test --name django-coleman "mrsarm/django-coleman:$TAG"

- name: Release Docker image
if: ${{ github.ref != 'refs/heads/master' }}
run: docker push "mrsarm/django-coleman:${GITHUB_REF_SLUG}"
run: docker push "mrsarm/django-coleman:$TAG"

- name: Download pose
run: wget https://github.com/mrsarm/pose/releases/download/0.4.0-b5/pose-0.4.0-b5-x86_64-unknown-linux-gnu.tar.gz
- name: Unpack pose
run: tar -xvf pose*.tar.gz
- name: Get compose.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./pose get -H "Authorization: token $GITHUB_TOKEN" \
"https://raw.githubusercontent.com/mrsarm/dcoleman-e2e/$GITHUB_REF_SLUG/compose.yaml" \
"$GITHUB_REF_SLUG:main"
"https://raw.githubusercontent.com/mrsarm/dcoleman-e2e/$TAG/compose.yaml" "$TAG:main"
- name: Get .env.example
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./pose get -H "Authorization: token $GITHUB_TOKEN" \
"https://raw.githubusercontent.com/mrsarm/dcoleman-e2e/$GITHUB_REF_SLUG/.env.example" \
"$GITHUB_REF_SLUG:main"
"https://raw.githubusercontent.com/mrsarm/dcoleman-e2e/$TAG/.env.example" "$TAG:main"
- name: Setup environment variables
run: cp .env.example .env

- name: Build compose file for CI with pose
if: ${{ github.ref != 'refs/heads/master' }}
run: |
./pose --no-docker config --tag "${GITHUB_REF_SLUG}" --tag-filter regex=mrsarm/ --progress -o ci.yaml
./pose --no-docker config --tag $TAG --tag-filter regex=mrsarm/ --progress -o ci.yaml
- name: Create compose file for CI without pose
if: ${{ github.ref == 'refs/heads/master' }}
run: cp compose.yaml ci.yaml

- name: Pull images
run: docker compose -f ci.yaml pull
&& docker compose -f ci.yaml pull dcoleman-e2e # images with profiles are not pulled by default

- name: Run e2e tests
run: docker compose -f ci.yaml run dcoleman-e2e

- name: Tag "latest"
if: ${{ github.ref == 'refs/heads/master' }}
run: docker tag "mrsarm/django-coleman:${GITHUB_REF_SLUG}" mrsarm/django-coleman:latest
run: docker tag "mrsarm/django-coleman:$TAG" mrsarm/django-coleman:latest
- name: Release "latest"
if: ${{ github.ref == 'refs/heads/master' }}
run: docker push mrsarm/django-coleman:latest

0 comments on commit fe62f81

Please sign in to comment.