Skip to content

Commit

Permalink
Added automation to fetch latest tag
Browse files Browse the repository at this point in the history
  • Loading branch information
lightningspirit committed Jun 15, 2022
1 parent d9e6adf commit 031fc44
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 23 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
name: Continuous Deployment

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
Expand Down
48 changes: 31 additions & 17 deletions .github/workflows/manual-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,44 @@ name: Manual Deployment

on:
workflow_dispatch:
schedule:
- cron: '59 23 * * *'

jobs:
deploy:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
fetch-depth: 1
fetch-depth: 0

- name: Login to Docker Registry
uses: docker/login-action@v1
- id: latest_tag
uses: thebritican/[email protected]
with:
registry: registry.moveyourdigital.dev
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
github_token: ${{ github.token }}
repo_path: actions/runner

- name: Build and Push to Docker Registry
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
push: true
tags: registry.moveyourdigital.dev/github/actions-runner:latest
- id: output
run: "echo 'RUNNER_VERSION=\"${{ steps.latest_tag.outputs.tag_name }}\"'"

# - name: Update Dockerfile RUNNER_VERSION org
# run: sed -i.bak "s/RUNNER_VERSION.*/RUNNER_VERSION=\"${steps.latest_tag.outputs.}\"/" Dockerfile

# - name: Login to Docker Registry
# uses: docker/login-action@v1
# with:
# registry: registry.moveyourdigital.dev
# username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
# password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}

# - name: Build and Push to Docker Registry
# uses: docker/build-push-action@v2
# with:
# context: .
# platforms: linux/amd64
# push: true
# tags: registry.moveyourdigital.dev/github/actions-runner:latest

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
# - name: Image digest
# run: echo ${{ steps.docker_build.outputs.digest }}
53 changes: 53 additions & 0 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Update Version

on:
workflow_dispatch:
schedule:
- cron: '59 23 * * *'

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- id: fetch-latest-release
uses: thebritican/[email protected]
with:
github_token: ${{ github.token }}
repo_path: actions/runner

- id: commit
run: |
TAG=${{ steps.fetch-latest-release.outputs.tag_name }}
sed -i.bak "s/RUNNER_VERSION.*/RUNNER_VERSION=\"${TAG:1}\"/" Dockerfile
if [[ `git status -uno --porcelain` ]]; then
git config --global user.name 'lightningspirit [Automated 🤖]'
git config --global user.email '[email protected]'
git commit -am "Bump to $TAG"
git push
fi
# - name: Update Dockerfile RUNNER_VERSION org
# run: sed -i.bak "s/RUNNER_VERSION.*/RUNNER_VERSION=\"${steps.latest_tag.outputs.}\"/" Dockerfile

# - name: Login to Docker Registry
# uses: docker/login-action@v1
# with:
# registry: registry.moveyourdigital.dev
# username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
# password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}

# - name: Build and Push to Docker Registry
# uses: docker/build-push-action@v2
# with:
# context: .
# platforms: linux/amd64
# push: true
# tags: registry.moveyourdigital.dev/github/actions-runner:latest

# - name: Image digest
# run: echo ${{ steps.docker_build.outputs.digest }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM ubuntu:21.04

# set the github runner version
ARG RUNNER_VERSION="2.293.0"
ARG RUNNER_VERSION="2.287.0"

ENV TZ=Europe/Lisbon
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
Expand Down

0 comments on commit 031fc44

Please sign in to comment.