Skip to content

Commit

Permalink
Add workflow and workflow dist
Browse files Browse the repository at this point in the history
  • Loading branch information
Dcrammer777 committed Oct 20, 2023
1 parent 666a589 commit 7fbd03c
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/wf1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Distribute Workflows

on:
push:
paths:
- "wf1/**"

jobs:
update-workflows:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Fetch repositories with specific topic
id: fetch-repos
run: |
REPOS=$(curl -H "Authorization: token $TOKEN" \
-H "Accept: application/vnd.github.mercy-preview+json" \
https://api.github.com/search/repositories?q=topic:<TOPIC>+org:<ORG> \
| jq -r '.items[].full_name')
echo "::set-output name=repos::$REPOS"
env:
TOKEN: ${{ secrets.GH_PAT }}
TOPIC: wf1
ORG: Galvanizer-Team

- name: Push to repositories with specific topic
run: |
for repo in ${{ steps.fetch-repos.outputs.repos }}; do
git clone "https://$TOKEN:x-oauth-basic@github.com/$repo.git"
# Create the .github/workflows directory if it doesn't exist
mkdir -p "$repo/.github/workflows"
cp -R wf1/* "$repo/.github/workflows/"
cd "$repo"
git add .github/workflows
git commit -m "Update workflows"
git push
cd ..
done
env:
TOKEN: ${{ secrets.GH_PAT }}
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": false,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"tailwindcss": {},
"printWidth": 120
}
39 changes: 39 additions & 0 deletions wf1/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and Containerize Next.js App

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Extract Repo Name
id: repo_name
run: echo "::set-output name=REPO_NAME::$(echo $GITHUB_REPOSITORY | cut -d '/' -f2)"

- name: Set git config for safe directory
run: git config --global --add safe.directory /github/workspace

- name: Bump version and push tag
id: bump_version
uses: anothrNick/github-tag-action@1.67.0
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch # Default bump type (major, minor, patch)

- name: Login to DOCR with Access Token
run: |
echo ${{ secrets.DOCR_TOKEN }} | docker login registry.digitalocean.com -u ${{ secrets.DOCR_TOKEN }} --password-stdin
- name: Build Docker Image with New Version
run: docker build -t registry.digitalocean.com/dc-containers-test/${{ steps.repo_name.outputs.REPO_NAME }}:${{ steps.bump_version.outputs.new_tag || 'latest' }} .

- name: Push Docker Image to DOCR
run: docker push registry.digitalocean.com/dc-containers-test/${{ steps.repo_name.outputs.REPO_NAME }}:${{ steps.bump_version.outputs.new_tag || 'latest' }}

0 comments on commit 7fbd03c

Please sign in to comment.