-
-
Notifications
You must be signed in to change notification settings - Fork 8
118 lines (97 loc) · 2.95 KB
/
main.yml
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Testing the Action
on: [pull_request]
env:
RUNNER_TEMP: /tmp
TEST_ARTIFACT_VERSION: 0.10.10
jobs:
local_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: 'npm'
check-latest: true
- name: Install Dependencies
run: npm ci
- name: Check Format
run: npm run format-check
- name: Run tests
run: npm test
test_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up action.yml
run: cp action_ci.yml action.yml
- name: Test the action
uses: ./
with:
api_key: '${{ secrets.GALAXY_API_KEY }}'
# Fake location that's a small amount of content
collection_dir: 'fake_collection'
- name: Test the action with a custom version
uses: ./
with:
api_key: '${{ secrets.GALAXY_API_KEY }}'
collection_dir: 'fake_collection'
# Custom version
galaxy_version: '${{ env.TEST_ARTIFACT_VERSION }}-test'
test_build_then_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up action.yml
run: cp action_ci.yml action.yml
- name: Test the action - only build
uses: ./
with:
api_key: '${{ secrets.GALAXY_API_KEY }}'
collection_dir: 'fake_collection'
# Different from above version
galaxy_version: '${{ env.TEST_ARTIFACT_VERSION }}-build'
build: true
publish: false
- name: Test the action - only publish
uses: ./
with:
api_key: '${{ secrets.GALAXY_API_KEY }}'
collection_dir: 'fake_collection'
# Should match version above
galaxy_version: '${{ env.TEST_ARTIFACT_VERSION }}-build'
build: false
publish: true
snapshot:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/artis3n/ansible_galaxy_collection-testartifact
tags: |
type=raw,value=SNAPSHOT-${{ github.sha }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
file: ./Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max