-
Notifications
You must be signed in to change notification settings - Fork 14
68 lines (59 loc) · 2.3 KB
/
setup-project.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Create scaf project
on: [push]
jobs:
build-and-push:
environment: dev
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
# not needed? https://github.com/docker/build-push-action/tree/releases/v5?tab=readme-ov-file#git-context
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
- name: Build and push Docker image using github's buildkit cache
uses: docker/build-push-action@v5
with:
push: true
tags: |
sixfeetup/scaf:${{ github.sha }}
sixfeetup/scaf:latest
context: .
file: ./Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
setup:
environment: dev
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Install Requirements
shell: bash
run: |
sudo apt-get update && sudo apt-get install --only-upgrade curl
sudo apt-get update && sudo apt-get install --only-upgrade make
sudo apt-get update && sudo apt-get install --only-upgrade python3
INSTALL_URL="https://raw.githubusercontent.com/sixfeetup/scaf/$GITHUB_REF_NAME/install.sh"
export SCAF_SCRIPT_BRANCH=$GITHUB_REF_NAME
git config --global init.defaultBranch main
git config --global user.email "[email protected]"
git config --global user.name "CI CD install deps"
echo "Downloading install script from $INSTALL_URL"
rm -f $HOME/.local/bin/scaf
echo "Installing scaf from $INSTALL_URL"
curl -sSL $INSTALL_URL | DEBUG=True bash
- name: Create Project with Scaf
shell: bash
run: |
IMAGE_TAG=$GITHUB_SHA
echo "Running scaf with sixfeetup/scaf:$IMAGE_TAG"
git config --global init.defaultBranch main
git config --global user.email "[email protected]"
git config --global user.name "CI CD Setup Project"
REPO_URL="https://github.com/sixfeetup/scaf.git"
$HOME/.local/bin/scaf myproject --no-input --checkout $GITHUB_REF_NAME $REPO_URL